diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-12-18 23:02:36 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-12-18 23:02:36 +0000 |
commit | ee698e84c17bf0fb97f5d8c8f4061125c749715e (patch) | |
tree | 785bd90264461d003985bc83fccb08494a0adc14 /test/CXX/expr/expr.prim | |
parent | 01505716d11c22384d610b32f4599c62272088bc (diff) | |
download | clang-ee698e84c17bf0fb97f5d8c8f4061125c749715e.tar.gz |
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 <rdar://problem/15560464>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197623 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim')
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp index 2ddcf18409..551c100ff7 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp +++ b/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'}} + }); + } +} |