diff options
| author | Erik Pilkington <erik.pilkington@gmail.com> | 2019-07-30 19:21:20 +0000 |
|---|---|---|
| committer | Erik Pilkington <erik.pilkington@gmail.com> | 2019-07-30 19:21:20 +0000 |
| commit | be19c48f6d6b7dd8e4c94dc15eba6963fa22fd10 (patch) | |
| tree | 0ae699d28781e47f370d4622e93858831c930589 | |
| parent | d2254dbf21a3243233b75294ef901086199df1b9 (diff) | |
| download | bcm5719-llvm-be19c48f6d6b7dd8e4c94dc15eba6963fa22fd10.tar.gz bcm5719-llvm-be19c48f6d6b7dd8e4c94dc15eba6963fa22fd10.zip | |
[Parser] Lambda capture lists can start with '*'
Fixes llvm.org/PR42778
llvm-svn: 367346
| -rw-r--r-- | clang/lib/Parse/ParseInit.cpp | 1 | ||||
| -rw-r--r-- | clang/test/Parser/cxx0x-lambda-expressions.cpp | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseInit.cpp b/clang/lib/Parse/ParseInit.cpp index 7a455484b90..769140f2d3b 100644 --- a/clang/lib/Parse/ParseInit.cpp +++ b/clang/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/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp index b297d7356ca..2acd8144b7a 100644 --- a/clang/test/Parser/cxx0x-lambda-expressions.cpp +++ b/clang/test/Parser/cxx0x-lambda-expressions.cpp @@ -126,6 +126,19 @@ void PR22122() { template void PR22122<int>(); +namespace PR42778 { +struct A { + template <class F> A(F&&) {} +}; + +struct S { + void mf() { A{[*this]{}}; } +#if __cplusplus < 201703L + // expected-warning@-2 {{C++17 extension}} +#endif +}; +} + struct S { template <typename T> void m (T x =[0); // expected-error{{expected variable name or 'this' in lambda capture list}} |

