summaryrefslogtreecommitdiff
path: root/test/PCH
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-05-16 06:20:58 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-05-16 06:20:58 +0000
commit0d8e9646bc000bab521ce52ed294209a92298cef (patch)
treee3fad0a3fa5871bc33949aef92a0b892656ef405 /test/PCH
parentc45c8dd54bc54f9be46546fdf002dc9fe07d1715 (diff)
downloadclang-0d8e9646bc000bab521ce52ed294209a92298cef.tar.gz
clang-0d8e9646bc000bab521ce52ed294209a92298cef.tar.bz2
clang-0d8e9646bc000bab521ce52ed294209a92298cef.tar.xz
First pass of semantic analysis for init-captures: check the initializer, build
a FieldDecl from it, and propagate both into the closure type and the LambdaExpr. You can't do much useful with them yet -- you can't use them within the body of the lambda, because we don't have a representation for "the this of the lambda, not the this of the enclosing context". We also don't have support or a representation for a nested capture of an init-capture yet, which was intended to work despite not being allowed by the current standard wording. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH')
-rw-r--r--test/PCH/cxx11-lambdas.mm9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/PCH/cxx11-lambdas.mm b/test/PCH/cxx11-lambdas.mm
index c00ec63807..807bf23067 100644
--- a/test/PCH/cxx11-lambdas.mm
+++ b/test/PCH/cxx11-lambdas.mm
@@ -33,6 +33,11 @@ inline int to_block_pointer(int n) {
return block(17);
}
+template<typename T>
+int init_capture(T t) {
+ return [&, x(t)] { return sizeof(x); };
+}
+
#else
// CHECK-PRINT: T add_slowly
@@ -45,4 +50,8 @@ int add(int x, int y) {
// CHECK-PRINT: inline int add_int_slowly_twice
// CHECK-PRINT: lambda = [&] (int z)
+
+// CHECK-PRINT: init_capture
+// CHECK-PRINT: [&, x( t )]
+
#endif