forked from OSchip/llvm-project
Improve recovery when we fail to parse the operand of a C++ named cast. Fixes PR5210
llvm-svn: 86234
This commit is contained in:
parent
6af6c3ee56
commit
f4f2ff773b
|
@ -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,
|
||||
|
|
|
@ -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}}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue