PR19249: Don't forget to DiagnoseUseOfDecl for the implicit use of a variable

in a lambda capture.

llvm-svn: 204757
This commit is contained in:
Richard Smith 2014-03-25 21:11:32 +00:00
parent afcbdb1570
commit d7b2a9ebd1
2 changed files with 6 additions and 0 deletions

View File

@ -1062,6 +1062,8 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
}
Var = R.getAsSingle<VarDecl>();
if (Var && DiagnoseUseOfDecl(Var, C->Loc))
continue;
}
// C++11 [expr.prim.lambda]p8:

View File

@ -359,3 +359,7 @@ namespace PR18473 {
};
template void f<NoCopy>(); // expected-note {{instantiation}}
}
void PR19249() {
auto x = [&x]{}; // expected-error {{cannot appear in its own init}}
}