This is an archive of the discontinued LLVM Phabricator instance.

PR 19339 - Parser confusion between lambda and designated initializer
AbandonedPublic

Authored by faisalv on Apr 4 2014, 9:17 AM.

Details

Reviewers
krememek
rsmith
Summary

http://llvm.org/bugs/show_bug.cgi?id=19339

Here is a reduced test case:

struct Foo {
  template<class T> Foo(T) {}
};

Foo f3 { [i{0}]{} };

The Parser gets confused in bool Parser::MayBeDesignationStart() in trying to distinguish between a lambda or a designated initializer when parsing
[i{0}]

FYI: Sema does not yet implement (recently voted into C++14? or is it C++17 I forget) the proper deduction for one element in a brace initializer yet.

This is a very cursory rough stab (includes a use of goto) at addressing this - just to draw attention to where i think the problem lies. I will leave it to those who grok the Parser better than me to either help me refine it - or conjure up their own fix.

Diff Detail