diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-20 17:37:52 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-20 17:37:52 +0000 |
commit | 78fe3e05a9ea1fc670e5cb0bc54f54e064595e2c (patch) | |
tree | 056febeb53f25bed88d3fe67553f43b8b40263ee /lib/Parse/ParseExprCXX.cpp | |
parent | df4ee102aa909e2f40c294701bfeffac63e8d29b (diff) |
PR13619: Make sure we're not at EOF before looking at NextToken().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | lib/Parse/ParseExprCXX.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index f2ba4c6e11..baad166814 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -926,10 +926,11 @@ ExprResult Parser::ParseCXXCasts() { // Check for "<::" which is parsed as "[:". If found, fix token stream, // diagnose error, suggest fix, and recover parsing. - Token Next = NextToken(); - if (Tok.is(tok::l_square) && Tok.getLength() == 2 && Next.is(tok::colon) && - areTokensAdjacent(Tok, Next)) - FixDigraph(*this, PP, Tok, Next, Kind, /*AtDigraph*/true); + if (Tok.is(tok::l_square) && Tok.getLength() == 2) { + Token Next = NextToken(); + if (Next.is(tok::colon) && areTokensAdjacent(Tok, Next)) + FixDigraph(*this, PP, Tok, Next, Kind, /*AtDigraph*/true); + } if (ExpectAndConsume(tok::less, diag::err_expected_less_after, CastName)) return ExprError(); |