mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52: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:
parent
c96d126b86
commit
e96d2f92c8
2 changed files with 14 additions and 1 deletions
|
@ -12410,4 +12410,10 @@ public class AST2CPPTests extends AST2CPPTestBase {
|
||||||
BindingAssertionHelper helper = getAssertionHelper();
|
BindingAssertionHelper helper = getAssertionHelper();
|
||||||
helper.assertVariableValue("waldo", 1);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4768,7 +4768,14 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
|
|
||||||
// base clause
|
// base clause
|
||||||
if (LT(1) == IToken.tCOLON) {
|
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
|
// content assist within the base-clause
|
||||||
if (LT(1) == IToken.tEOC) {
|
if (LT(1) == IToken.tEOC) {
|
||||||
return astClassSpecifier;
|
return astClassSpecifier;
|
||||||
|
|
Loading…
Add table
Reference in a new issue