1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fixed Bug 92980 - [Parser] infinite loop caused by invalid source code

This commit is contained in:
John Camelon 2005-04-27 19:11:32 +00:00
parent 15fc3932fa
commit 308e1f4417
2 changed files with 8 additions and 0 deletions

View file

@ -3792,5 +3792,10 @@ public class AST2CPPTests extends AST2BaseTest {
assertEquals( declarators.length, 1 ); assertEquals( declarators.length, 1 );
assertTrue( declarators[0] instanceof IASTArrayDeclarator ); assertTrue( declarators[0] instanceof IASTArrayDeclarator );
} }
public void testBug92980() throws Exception {
String code = "struct A { A(); A(const A&) throw(1); ~A() throw(X); };"; //$NON-NLS-1$
parse( code, ParserLanguage.CPP, true, false );
}
} }

View file

@ -3943,6 +3943,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
consume(); consume();
break; break;
default: default:
IToken before = LA(1);
try { try {
exceptionSpecIds.add(typeId(false, false)); exceptionSpecIds.add(typeId(false, false));
} catch (BacktrackException e) { } catch (BacktrackException e) {
@ -3955,6 +3956,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
p p
.setPropertyInParent(IASTProblemHolder.PROBLEM); .setPropertyInParent(IASTProblemHolder.PROBLEM);
exceptionSpecIds.add(typeIdProblem); exceptionSpecIds.add(typeIdProblem);
if( before == LA(1) )
done = true;
} }
break; break;
} }