mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed Bug 95424 - [Parser] Bad AST from static function call
This commit is contained in:
parent
89ec5fadf6
commit
3462e648ba
2 changed files with 11 additions and 0 deletions
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||
|
@ -100,6 +101,15 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
|||
|
||||
public class AST2CPPTests extends AST2BaseTest {
|
||||
|
||||
public void testBug95424() throws Exception {
|
||||
IASTTranslationUnit tu = parse( "void f(){ traits_type::copy(__r->_M_refdata(), __buf, __i); }", ParserLanguage.CPP, true, true );
|
||||
tu = parse( "void f(){ traits_type::copy(__r->_M_refdata(), __buf, __i); }", ParserLanguage.CPP, false, true );
|
||||
IASTFunctionDefinition f = (IASTFunctionDefinition) tu.getDeclarations()[0];
|
||||
IASTCompoundStatement cs = (IASTCompoundStatement) f.getBody();
|
||||
IASTExpressionStatement es = (IASTExpressionStatement) cs.getStatements()[0];
|
||||
assertTrue( es.getExpression() instanceof IASTFunctionCallExpression );
|
||||
}
|
||||
|
||||
public void testSimpleClass() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer("class A { } a;"); //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -3796,6 +3796,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
finalOffset = consume(IToken.tRPAREN).getEndOffset();
|
||||
} catch (BacktrackException bte) {
|
||||
backup(mark);
|
||||
innerDecl = null;
|
||||
}
|
||||
declaratorName = createName();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue