summaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.prim
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-12-18 23:02:36 +0000
committerDouglas Gregor <dgregor@apple.com>2013-12-18 23:02:36 +0000
commitee698e84c17bf0fb97f5d8c8f4061125c749715e (patch)
tree785bd90264461d003985bc83fccb08494a0adc14 /test/CXX/expr/expr.prim
parent01505716d11c22384d610b32f4599c62272088bc (diff)
downloadclang-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.cpp9
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'}}
+ });
+ }
+}