diff options
| author | Akira Hatanaka <ahatanaka@apple.com> | 2017-03-01 06:11:25 +0000 |
|---|---|---|
| committer | Akira Hatanaka <ahatanaka@apple.com> | 2017-03-01 06:11:25 +0000 |
| commit | 7cbbb88f238527dc6633c4cec1e1f057555410a3 (patch) | |
| tree | 86e4c2be6da62047a0847dd2544ee44e483a7af2 /clang/test/SemaObjCXX | |
| parent | 1a1d9594231929abfdc61be02476719967f0bcf8 (diff) | |
| download | bcm5719-llvm-7cbbb88f238527dc6633c4cec1e1f057555410a3.tar.gz bcm5719-llvm-7cbbb88f238527dc6633c4cec1e1f057555410a3.zip | |
[Sema] Add variable captured by a block to the enclosing lambda's
potential capture list.
Fix Sema::getCurLambda() to return the innermost lambda scope when there
is a block enclosed in the lambda. Previously, the method would return a
nullptr in such cases, which would prevent a variable captured by the
enclosed block to be added to the lambda scope's potential capture list.
rdar://problem/28412462
Differential Revision: https://reviews.llvm.org/D25556
llvm-svn: 296584
Diffstat (limited to 'clang/test/SemaObjCXX')
| -rw-r--r-- | clang/test/SemaObjCXX/blocks.mm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/test/SemaObjCXX/blocks.mm b/clang/test/SemaObjCXX/blocks.mm index 3f901cc0a84..bdd5538e92b 100644 --- a/clang/test/SemaObjCXX/blocks.mm +++ b/clang/test/SemaObjCXX/blocks.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -Wno-objc-root-class -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -Wno-objc-root-class -std=c++14 %s @protocol NSObject; void bar(id(^)(void)); @@ -145,6 +145,17 @@ namespace DependentReturn { template void f<X>(X); } +namespace GenericLambdaCapture { +int test(int outerp) { + auto lambda =[&](auto p) { + return ^{ + return p + outerp; + }(); + }; + return lambda(1); +} +} + namespace MoveBlockVariable { struct B0 { }; |

