[PATCH] D36853: [Parser] Correct initalizer typos before lambda capture type is deduced.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 22 10:56:35 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL311480: [Parser] Correct initalizer typos before lambda capture type is deduced. (authored by vsapsai).

Changed prior to commit:
  https://reviews.llvm.org/D36853?vs=111716&id=112201#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36853

Files:
  cfe/trunk/lib/Parse/ParseExprCXX.cpp
  cfe/trunk/test/SemaCXX/cxx1y-init-captures.cpp


Index: cfe/trunk/test/SemaCXX/cxx1y-init-captures.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/cxx1y-init-captures.cpp
+++ cfe/trunk/test/SemaCXX/cxx1y-init-captures.cpp
@@ -206,3 +206,11 @@
   find(weight); // expected-note {{in instantiation of function template specialization}}
 }
 }
+
+namespace init_capture_undeclared_identifier {
+  auto a = [x = y]{}; // expected-error{{use of undeclared identifier 'y'}}
+
+  int typo_foo; // expected-note 2 {{'typo_foo' declared here}}
+  auto b = [x = typo_boo]{}; // expected-error{{use of undeclared identifier 'typo_boo'; did you mean 'typo_foo'}}
+  auto c = [x(typo_boo)]{}; // expected-error{{use of undeclared identifier 'typo_boo'; did you mean 'typo_foo'}}
+}
Index: cfe/trunk/lib/Parse/ParseExprCXX.cpp
===================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp
@@ -966,6 +966,8 @@
     // that would be an error.
 
     ParsedType InitCaptureType;
+    if (!Init.isInvalid())
+      Init = Actions.CorrectDelayedTyposInExpr(Init.get());
     if (Init.isUsable()) {
       // Get the pointer and store it in an lvalue, so we can use it as an
       // out argument.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36853.112201.patch
Type: text/x-patch
Size: 1268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170822/93f700bd/attachment.bin>


More information about the cfe-commits mailing list