[cfe-commits] r86234 - in /cfe/trunk: lib/Parse/ParseExprCXX.cpp test/SemaCXX/cast-conversion.cpp
Douglas Gregor
dgregor at apple.com
Thu Nov 5 21:48:00 PST 2009
Author: dgregor
Date: Thu Nov 5 23:48:00 2009
New Revision: 86234
URL: http://llvm.org/viewvc/llvm-project?rev=86234&view=rev
Log:
Improve recovery when we fail to parse the operand of a C++ named cast. Fixes PR5210
Modified:
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/test/SemaCXX/cast-conversion.cpp
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=86234&r1=86233&r2=86234&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Thu Nov 5 23:48:00 2009
@@ -381,13 +381,7 @@
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,
Modified: cfe/trunk/test/SemaCXX/cast-conversion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cast-conversion.cpp?rev=86234&r1=86233&r2=86234&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cast-conversion.cpp (original)
+++ cfe/trunk/test/SemaCXX/cast-conversion.cpp Thu Nov 5 23:48:00 2009
@@ -33,3 +33,14 @@
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}}
+ }
+};
More information about the cfe-commits
mailing list