Parse: Don't let BalancedDelimiterTracker consume cxx_defaultarg_end

It is not correct to let it consume the cxx_defaultarg_end token.  I'm
starting to wonder if it makes more sense to stop SkipUntil from
consuming such tokens.

llvm-svn: 225615
This commit is contained in:
David Majnemer 2015-01-12 03:14:18 +00:00
parent 3661a82ef6
commit a3aef35d54
2 changed files with 6 additions and 1 deletions

View File

@ -1948,7 +1948,7 @@ bool BalancedDelimiterTracker::diagnoseMissingClose() {
// token.
if (P.Tok.isNot(tok::r_paren) && P.Tok.isNot(tok::r_brace) &&
P.Tok.isNot(tok::r_square) &&
P.SkipUntil(Close, FinalToken,
P.SkipUntil(Close, FinalToken, tok::cxx_defaultarg_end,
Parser::StopAtSemi | Parser::StopBeforeMatch) &&
P.Tok.is(Close))
LClose = P.ConsumeAnyToken();

View File

@ -103,3 +103,8 @@ struct S {
template <typename T>
void m (T x =[0); // expected-error{{expected variable name or 'this' in lambda capture list}}
} s;
struct U {
template <typename T>
void m_fn1(T x = 0[0); // expected-error{{expected ']'}} expected-note{{to match this '['}}
} *U;