From b578aee665aad5ed1a46a26217c730fdfbfc8c2e Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 7 Nov 2012 19:08:05 +0000 Subject: [PATCH] PR12713 - crash on invalid due to unmatched parens in decltype git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167547 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/Parser.cpp | 4 ++-- test/SemaCXX/decltype.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 7bf4220199..f4cdd619ce 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -1940,8 +1940,8 @@ bool BalancedDelimiterTracker::diagnoseMissingClose() { } P.Diag(P.Tok, DID); P.Diag(LOpen, diag::note_matching) << LHSName; - if (P.SkipUntil(Close)) - LClose = P.Tok.getLocation(); + if (P.SkipUntil(Close, /*StopAtSemi*/ true, /*DontConsume*/ true)) + LClose = P.ConsumeAnyToken(); return true; } diff --git a/test/SemaCXX/decltype.cpp b/test/SemaCXX/decltype.cpp index f9bdececc4..ccde3dcfb3 100644 --- a/test/SemaCXX/decltype.cpp +++ b/test/SemaCXX/decltype.cpp @@ -36,3 +36,10 @@ struct C { C(decltype(undeclared; // expected-error {{undeclared identifier}} \ // expected-error {{expected ')'}} expected-note {{to match this '('}} }; + +template +class conditional { +}; + +void foo(conditional) { // expected-note 2 {{to match this '('}} expected-error {{expected ')'}} +} // expected-error {{expected function body after function declarator}} expected-error 2 {{expected '>'}} expected-error {{expected ')'}} -- 2.40.0