summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-06 05:48:00 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-06 05:48:00 +0000
commitf4f2ff773be2a11d976b5c7a1f6a15b978c1ff01 (patch)
tree828ef6817de172a74df590a18662e943997e3334
parent6af6c3ee565e854e89be248682490ea9d6b10ca7 (diff)
downloadbcm5719-llvm-f4f2ff773be2a11d976b5c7a1f6a15b978c1ff01.tar.gz
bcm5719-llvm-f4f2ff773be2a11d976b5c7a1f6a15b978c1ff01.zip
Improve recovery when we fail to parse the operand of a C++ named cast. Fixes PR5210
llvm-svn: 86234
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp8
-rw-r--r--clang/test/SemaCXX/cast-conversion.cpp11
2 files changed, 12 insertions, 7 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index a00dfb0b4c3..fa8e64dc125 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -381,13 +381,7 @@ Parser::OwningExprResult Parser::ParseCXXCasts() {
OwningExprResult Result = ParseExpression();
// Match the ')'.
- if (Result.isInvalid())
- SkipUntil(tok::r_paren);
-
- if (Tok.is(tok::r_paren))
- RParenLoc = ConsumeParen();
- else
- MatchRHSPunctuation(tok::r_paren, LParenLoc);
+ RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
if (!Result.isInvalid() && !CastTy.isInvalid())
Result = Actions.ActOnCXXNamedCast(OpLoc, Kind,
diff --git a/clang/test/SemaCXX/cast-conversion.cpp b/clang/test/SemaCXX/cast-conversion.cpp
index 936933d95d1..3b6a9d6f8c4 100644
--- a/clang/test/SemaCXX/cast-conversion.cpp
+++ b/clang/test/SemaCXX/cast-conversion.cpp
@@ -33,3 +33,14 @@ void test_X0() {
const char array[2];
make_X0(array);
}
+
+// PR5210 recovery
+class C {
+protected:
+ template <int> float* &f0(); // expected-note{{candidate}}
+ template <unsigned> float* &f0(); // expected-note{{candidate}}
+
+ void f1() {
+ static_cast<float*>(f0<0>()); // expected-error{{ambiguous}}
+ }
+};
OpenPOWER on IntegriCloud