[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 21:22:00 PST 2016


ahatanak added a comment.

Thanks all for the review.



================
Comment at: cfe/trunk/test/SemaCXX/lambda-expressions.cpp:572
+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'?}}
----------------
"expected expression" error is emitted twice because ParseInitializer() is called twice: first MayBeDesignationStart is called, and then it throws away what was parsed, and then ParseInitializer() is called the second time at Parser::ParseBraceInitializer:427.

I'm not sure what's the best way to fix this.


Repository:
  rL LLVM

https://reviews.llvm.org/D25206





More information about the cfe-commits mailing list