r367346 - [Parser] Lambda capture lists can start with '*'
Erik Pilkington via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 30 12:21:21 PDT 2019
Author: epilk
Date: Tue Jul 30 12:21:20 2019
New Revision: 367346
URL: http://llvm.org/viewvc/llvm-project?rev=367346&view=rev
Log:
[Parser] Lambda capture lists can start with '*'
Fixes llvm.org/PR42778
Modified:
cfe/trunk/lib/Parse/ParseInit.cpp
cfe/trunk/test/Parser/cxx0x-lambda-expressions.cpp
Modified: cfe/trunk/lib/Parse/ParseInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseInit.cpp?rev=367346&r1=367345&r2=367346&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseInit.cpp (original)
+++ cfe/trunk/lib/Parse/ParseInit.cpp Tue Jul 30 12:21:20 2019
@@ -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.
Modified: cfe/trunk/test/Parser/cxx0x-lambda-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-lambda-expressions.cpp?rev=367346&r1=367345&r2=367346&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx0x-lambda-expressions.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-lambda-expressions.cpp Tue Jul 30 12:21:20 2019
@@ -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 at -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}}
More information about the cfe-commits
mailing list