[PATCH] D25206: [Parser] Correct typo after lambda capture initializer is parsed

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 19 18:21:58 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL290156: [Parser] Correct typo after lambda capture initializer is parsed. (authored by ahatanak).

Changed prior to commit:
  https://reviews.llvm.org/D25206?vs=75819&id=82052#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25206

Files:
  cfe/trunk/lib/Parse/ParseExprCXX.cpp
  cfe/trunk/test/SemaCXX/lambda-expressions.cpp


Index: cfe/trunk/lib/Parse/ParseExprCXX.cpp
===================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp
@@ -902,6 +902,8 @@
           SourceLocation StartLoc = Tok.getLocation();
           InMessageExpressionRAIIObject MaybeInMessageExpression(*this, true);
           Init = ParseInitializer();
+          if (!Init.isInvalid())
+            Init = Actions.CorrectDelayedTyposInExpr(Init.get());
 
           if (Tok.getLocation() != StartLoc) {
             // Back out the lexing of the token after the initializer.
Index: cfe/trunk/test/SemaCXX/lambda-expressions.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/lambda-expressions.cpp
+++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp
@@ -558,3 +558,18 @@
   decltype(a)::D b;
 }
 }
+
+namespace PR30566 {
+int name1; // expected-note {{'name1' declared here}}
+
+struct S1 {
+  template<class T>
+  S1(T t) { s = sizeof(t); }
+  int s;
+};
+
+void foo1() {
+  auto s0 = S1{[name=]() {}}; // expected-error 2 {{expected expression}}
+  auto s1 = S1{[name=name]() {}}; // expected-error {{use of undeclared identifier 'name'; did you mean 'name1'?}}
+}
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25206.82052.patch
Type: text/x-patch
Size: 1252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161220/c938087a/attachment.bin>


More information about the cfe-commits mailing list