From: Douglas Gregor Date: Thu, 9 Feb 2012 02:20:38 +0000 (+0000) Subject: Don't complain about the lack of a constructor for a lambda expression. They are... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e058eb02875530f1aed10c3417a1011744239b1;p=clang Don't complain about the lack of a constructor for a lambda expression. They are constructed in different ways git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150136 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index ca64af644f..62332b8b4a 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -3632,7 +3632,8 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) { // complain about any non-static data members of reference or const scalar // type, since they will never get initializers. if (!Record->isInvalidDecl() && !Record->isDependentType() && - !Record->isAggregate() && !Record->hasUserDeclaredConstructor()) { + !Record->isAggregate() && !Record->hasUserDeclaredConstructor() && + !Record->isLambda()) { bool Complained = false; for (RecordDecl::field_iterator F = Record->field_begin(), FEnd = Record->field_end(); diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index 033bf4ab3c..776d27a364 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -29,7 +29,7 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, // Start constructing the lambda class. CXXRecordDecl *Class = CXXRecordDecl::Create(Context, TTK_Class, DC, Intro.Range.getBegin(), - /*IdLoc=*/SourceLocation(), + /*IdLoc=*/Intro.Range.getBegin(), /*Id=*/0); Class->startDefinition(); Class->setLambda(true);