1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 526134 - Recover from failure to parse a base-clause in a class-specifier

Change-Id: I642650020dc2c0363376c8172769f4b5ea2d90c4
This commit is contained in:
Nathan Ridge 2017-10-18 21:27:15 -04:00
parent c96d126b86
commit e96d2f92c8
2 changed files with 14 additions and 1 deletions

View file

@ -12410,4 +12410,10 @@ public class AST2CPPTests extends AST2CPPTestBase {
BindingAssertionHelper helper = getAssertionHelper();
helper.assertVariableValue("waldo", 1);
}
// struct A {};
// struct A* b = (1 == 1) ? new struct A : new struct A;
public void test_ElabTypeSpecInNewExprInConditional_526134() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -4768,7 +4768,14 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
// base clause
if (LT(1) == IToken.tCOLON) {
baseClause(astClassSpecifier);
try {
baseClause(astClassSpecifier);
} catch (BacktrackException e) {
// Couldn't parse a base-clause.
// Backtrack and try an elaborated-type-specifier instead.
backup(mark);
throw e;
}
// content assist within the base-clause
if (LT(1) == IToken.tEOC) {
return astClassSpecifier;