diff options
| author | Faisal Vali <faisalv@yahoo.com> | 2017-04-29 03:49:17 +0000 |
|---|---|---|
| committer | Faisal Vali <faisalv@yahoo.com> | 2017-04-29 03:49:17 +0000 |
| commit | 1f961df10c7f523266a5f66a228aade82110ab11 (patch) | |
| tree | 75da6eca1cfeb8ff2a180f0ecbecc42d794f4b29 /clang/test | |
| parent | e9a99327121d6bc5680ac0406ef71294d841802f (diff) | |
| download | bcm5719-llvm-1f961df10c7f523266a5f66a228aade82110ab11.tar.gz bcm5719-llvm-1f961df10c7f523266a5f66a228aade82110ab11.zip | |
Fix PR32831: 'this capture while instantiating generic lambda call operator specialization
When computing the appropriate cv-qualifiers for the 'this' capture, we have to examine each enclosing lambda - but when using the FunctionScopeInfo stack we have to ensure that the lambda below (outer) is the decl-context of the closure-class of the current lambda.
https://bugs.llvm.org/show_bug.cgi?id=32831
llvm-svn: 301735
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/cxx1z-lambda-star-this.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx1z-lambda-star-this.cpp b/clang/test/SemaCXX/cxx1z-lambda-star-this.cpp index a84e653f5c8..56fe7991422 100644 --- a/clang/test/SemaCXX/cxx1z-lambda-star-this.cpp +++ b/clang/test/SemaCXX/cxx1z-lambda-star-this.cpp @@ -229,3 +229,69 @@ int main() { } //end ns test_star_this
+namespace PR32831 {
+// https://bugs.llvm.org/show_bug.cgi?id=32831
+namespace ns1 {
+template <typename Func> void fun_template(Func func) {
+ (void) [&]() {
+ func(0);
+ };
+}
+
+class A {
+ void member_foo() {
+ (void) [this] {
+ (void) [this] {
+ fun_template(
+ [this](auto X) {
+ auto L = [this](auto Y)
+ { member_foo(); };
+ L(5);
+ }
+ );
+ fun_template(
+ [this](auto) { member_foo(); });
+
+ };
+ };
+ }
+};
+} // end ns1
+
+namespace ns2 {
+
+struct B {
+ int data = 0;
+ template<class F>
+ void mem2(F f) {
+ (void) [&] (auto f) {
+ (void) [&] { f(this->data); };
+ }(f);
+ }
+
+};
+
+class A {
+ void member_foo() {
+ (void) [this] {
+ (void) [this] {
+ B{}.mem2(
+ [this](auto X) {
+ auto L = [this](auto Y)
+ { member_foo(); };
+ L(5);
+ }
+ );
+ B{}.mem2(
+ [this](auto) { member_foo(); });
+
+ };
+ };
+ }
+};
+
+
+} // end ns2
+
+}
+
|

