diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -3577,6 +3577,8 @@ CapturingScopeInfo *CurCap = cast(getCurFunction()); QualType FnRetType = CurCap->ReturnType; LambdaScopeInfo *CurLambda = dyn_cast(CurCap); + if (CurLambda && CurLambda->CallOperator->getType().isNull()) + return StmtError(); bool HasDeducedReturnType = CurLambda && hasDeducedReturnType(CurLambda->CallOperator); diff --git a/clang/test/SemaCXX/gh48527.cpp b/clang/test/SemaCXX/gh48527.cpp new file mode 100644 --- /dev/null +++ b/clang/test/SemaCXX/gh48527.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +int main() { // expected-note {{to match this '{'}} + auto a = [](void)__attribute__((b(({ // expected-note {{to match this '('}} + return 0; +} // expected-error 3 {{expected ')'}} \ + // expected-error {{expected ';' at end of declaration}} +// expected-error@+2 {{expected ')'}} +// expected-error@+1 {{expected body of lambda expression}} +// expected-error {{expected '}'}}