llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Qiu Chaofan (ecnelises) <details> <summary>Changes</summary> Fixes #<!-- -->72198 --- Full diff: https://github.com/llvm/llvm-project/pull/72230.diff 2 Files Affected: - (modified) clang/lib/Sema/SemaExpr.cpp (+2) - (modified) clang/test/SemaCXX/lambda-invalid-capture.cpp (+6) ``````````diff diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 5b0c4439fd1710c..cb7383ea8790f67 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -19773,6 +19773,8 @@ bool Sema::tryCaptureVariable( // declcontext can either capture the variable or have already captured // the variable. CaptureType = Var->getType(); + if (CaptureType.isNull()) + return true; DeclRefType = CaptureType.getNonReferenceType(); bool Nested = false; bool Explicit = (Kind != TryCapture_Implicit); diff --git a/clang/test/SemaCXX/lambda-invalid-capture.cpp b/clang/test/SemaCXX/lambda-invalid-capture.cpp index 236753871d7018b..b77a844cfbbda50 100644 --- a/clang/test/SemaCXX/lambda-invalid-capture.cpp +++ b/clang/test/SemaCXX/lambda-invalid-capture.cpp @@ -23,3 +23,9 @@ int pr43080(int i) { // expected-note {{declared here}} i; // expected-error {{variable 'i' cannot be implicitly captured in a lambda with no capture-default specified}} }(); } + +void pr72198() { + int [_, b] = {0, 0}; // expected-error{{decomposition declaration cannot be declared with type 'int'; declared type must be 'auto' or reference to 'auto'}} \ + expected-error{{excess elements in scalar initializer}} + [b]{}; // expected-warning{{expression result unused}} +} `````````` </details> https://github.com/llvm/llvm-project/pull/72230 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits