diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-11-07 19:08:05 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-11-07 19:08:05 +0000 |
commit | b578aee665aad5ed1a46a26217c730fdfbfc8c2e (patch) | |
tree | ad04d7cb41accfd4ae6925b524d5104dc0a24654 | |
parent | 3b45ca9e6292b45ab39d8c44d15a617017f26198 (diff) |
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
-rw-r--r-- | lib/Parse/Parser.cpp | 4 | ||||
-rw-r--r-- | 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<typename> +class conditional { +}; + +void foo(conditional<decltype((1),int>) { // expected-note 2 {{to match this '('}} expected-error {{expected ')'}} +} // expected-error {{expected function body after function declarator}} expected-error 2 {{expected '>'}} expected-error {{expected ')'}} |