From: David Majnemer Date: Mon, 12 Jan 2015 03:14:18 +0000 (+0000) Subject: Parse: Don't let BalancedDelimiterTracker consume cxx_defaultarg_end X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=659adeea4b7d6cd76ee873e07a9d7ead6383a7b7;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225615 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 7ccd2092a2..c9243d6488 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -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(); diff --git a/test/Parser/cxx0x-lambda-expressions.cpp b/test/Parser/cxx0x-lambda-expressions.cpp index e1be75686a..6f69d8096e 100644 --- a/test/Parser/cxx0x-lambda-expressions.cpp +++ b/test/Parser/cxx0x-lambda-expressions.cpp @@ -103,3 +103,8 @@ struct S { template void m (T x =[0); // expected-error{{expected variable name or 'this' in lambda capture list}} } s; + +struct U { + template + void m_fn1(T x = 0[0); // expected-error{{expected ']'}} expected-note{{to match this '['}} +} *U;