From d1e3ceb5ecb9a156f45d15ae8ccdcab0deb85590 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 18 Dec 2013 23:02:36 +0000 Subject: Require the type of a by-copy capture to be complete before creating its field. The problem here is more serious than the fix implies. Adding a field to a class updates the triviality bits for the class (among other things). Failing to require a complete type before adding the field meant that these updates don't happen in the well-formed case where the capture is an uninstantiated class template specialization, leading the lambda itself to be treated as having a trivial copy constructor when it shouldn't. Fixes . llvm-svn: 197623 --- clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/test/CXX/expr/expr.prim/expr.prim.lambda') diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp index 2ddcf18409e..551c100ff7a 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp @@ -100,3 +100,12 @@ namespace rdar14468891 { [x]() {}(); // expected-error{{by-copy capture of value of abstract type 'rdar14468891::X'}} } } + +namespace rdar15560464 { + struct X; // expected-note{{forward declaration of 'rdar15560464::X'}} + void foo(const X& param) { + auto x = ([=]() { + auto& y = param; // expected-error{{by-copy capture of variable 'param' with incomplete type 'const rdar15560464::X'}} + }); + } +} -- cgit v1.2.3