llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Sirraide <details> <summary>Changes</summary> I forgot to check for dependent types in #<!-- -->187828; we somehow didn’t have tests for this so CI didn’t catch this... --- Full diff: https://github.com/llvm/llvm-project/pull/188910.diff 2 Files Affected: - (modified) clang/lib/Sema/SemaExpr.cpp (+2-1) - (modified) clang/test/SemaCXX/cxx23-builtin-subscript.cpp (+3) ``````````diff diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index cbbb4f791ee80..4856a51aa6a0d 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -5173,7 +5173,8 @@ ExprResult Sema::ActOnArraySubscriptExpr(Scope *S, Expr *base, // Issue a better diagnostic if we tried to pass multiple arguments to // a builtin subscript operator rather than diagnosing this as a generic // overload resolution failure. - if (ArgExprs.size() != 1 && !base->getType()->isRecordType() && + if (ArgExprs.size() != 1 && !base->getType()->isDependentType() && + !base->getType()->isRecordType() && !base->getType()->isObjCObjectPointerType()) { Diag(base->getExprLoc(), diag::err_ovl_builtin_subscript_expects_single_arg) << base->getType() << base->getSourceRange(); diff --git a/clang/test/SemaCXX/cxx23-builtin-subscript.cpp b/clang/test/SemaCXX/cxx23-builtin-subscript.cpp index 8067663ded676..09602cf49bf1e 100644 --- a/clang/test/SemaCXX/cxx23-builtin-subscript.cpp +++ b/clang/test/SemaCXX/cxx23-builtin-subscript.cpp @@ -62,3 +62,6 @@ void f() { p.three[1, 2][3] = 4; // expected-error {{property subscript expects exactly one argument}} p.three[1][2, 3] = 4; // expected-error {{property subscript expects exactly one argument}} } + +template<class T> +void dependent(T x) { x[0, 0]; } `````````` </details> https://github.com/llvm/llvm-project/pull/188910 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
