From: Erik Pilkington Date: Tue, 30 Jul 2019 19:21:20 +0000 (+0000) Subject: [Parser] Lambda capture lists can start with '*' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9721cbc526fc140a7e4463434271e95dc59a4640;p=clang [Parser] Lambda capture lists can start with '*' Fixes llvm.org/PR42778 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367346 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp index 7a455484b9..769140f2d3 100644 --- a/lib/Parse/ParseInit.cpp +++ b/lib/Parse/ParseInit.cpp @@ -45,6 +45,7 @@ bool Parser::MayBeDesignationStart() { case tok::amp: case tok::kw_this: + case tok::star: case tok::identifier: // We have to do additional analysis, because these could be the // start of a constant expression or a lambda capture list. diff --git a/test/Parser/cxx0x-lambda-expressions.cpp b/test/Parser/cxx0x-lambda-expressions.cpp index b297d7356c..2acd8144b7 100644 --- a/test/Parser/cxx0x-lambda-expressions.cpp +++ b/test/Parser/cxx0x-lambda-expressions.cpp @@ -126,6 +126,19 @@ void PR22122() { template void PR22122(); +namespace PR42778 { +struct A { + template A(F&&) {} +}; + +struct S { + void mf() { A{[*this]{}}; } +#if __cplusplus < 201703L + // expected-warning@-2 {{C++17 extension}} +#endif +}; +} + struct S { template void m (T x =[0); // expected-error{{expected variable name or 'this' in lambda capture list}}