From: Fariborz Jahanian Date: Tue, 8 Jan 2013 23:40:08 +0000 (+0000) Subject: Remove lambda from my last patch. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b3040f51a96248fa34ba14cf54914d361142bd7;p=clang Remove lambda from my last patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171915 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 4d8f267098..691da35451 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -4612,9 +4612,6 @@ let CategoryName = "Lambda Issue" in { def err_lambda_capture_vm_type : Error< "variable %0 with variably modified type cannot be captured in " "a lambda expression">; - def err_lambda_capture_flexarray_type : Error< - "variable %0 with flexible array member cannot be captured in " - "a lambda expression">; def err_lambda_impcap : Error< "variable %0 cannot be implicitly captured in a lambda with no " "capture-default specified">; diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 326c59a365..352be07f1a 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -10762,13 +10762,10 @@ bool Sema::tryCaptureVariable(VarDecl *Var, SourceLocation Loc, // Prohibit structs with flexiable array members too. // We cannot capture what is in the tail end of the struct. if (const RecordType *VTTy = Var->getType()->getAs()) { - if (VTTy->getDecl()->hasFlexibleArrayMember()) { + if (VTTy->getDecl()->hasFlexibleArrayMember() && IsBlock) { if (BuildAndDiagnose) { if (IsBlock) Diag(Loc, diag::err_ref_flexarray_type); - else - Diag(Loc, diag::err_lambda_capture_flexarray_type) - << Var->getDeclName(); Diag(Var->getLocation(), diag::note_previous_decl) << Var->getDeclName(); } diff --git a/test/SemaObjCXX/capturing-flexible-array-in-block.mm b/test/SemaObjCXX/capturing-flexible-array-in-block.mm index 4899c4653a..6ffe350135 100644 --- a/test/SemaObjCXX/capturing-flexible-array-in-block.mm +++ b/test/SemaObjCXX/capturing-flexible-array-in-block.mm @@ -1,9 +1,7 @@ -// RUN: %clang_cc1 -fsyntax-only -fblocks -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s // rdar://12655829 void f() { - struct { int x; int y[]; } a; // expected-note 2 {{'a' declared here}} + struct { int x; int y[]; } a; // expected-note {{'a' declared here}} ^{return a.x;}(); // expected-error {{cannot refer to declaration of structure variable with flexible array member inside block}} - - [] {return a.x;}(); // expected-error {{variable 'a' with flexible array member cannot be captured in a lambda expression}} }