1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

76947: [Parser] Declaration parsed as Expression

This commit is contained in:
Andrew Niefer 2004-10-25 21:21:57 +00:00
parent 72b2f7aa1e
commit a0bf3dad3b
3 changed files with 5 additions and 3 deletions

View file

@ -962,7 +962,8 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
public void testBug39551B() throws Exception
{
IASTVariable variable = (IASTVariable)parse("_Imaginary double id = 99.99 * __I__;", true, ParserLanguage.C).getDeclarations().next(); //$NON-NLS-1$
//this used to be 99.99 * __I__, but I don't know where the __I__ came from, its not in C99, nor in GCC
IASTVariable variable = (IASTVariable)parse("_Imaginary double id = 99.99 * 1i;", true, ParserLanguage.C).getDeclarations().next(); //$NON-NLS-1$
assertEquals( variable.getName(), "id"); //$NON-NLS-1$
assertTrue( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).isImaginary() );
}

View file

@ -39,7 +39,8 @@ public class ParserProblemFactory extends BaseProblemFactory
if( checkBitmask( id, IProblem.INTERNAL_RELATED ) )
return createInternalProblem( id, start, end, line, file, arg, warn, error );
if ( checkBitmask( id, IProblem.SYNTAX_RELATED ) )
if ( checkBitmask( id, IProblem.SYNTAX_RELATED ) ||
checkBitmask( id, IProblem.SEMANTICS_RELATED) )
return super.createProblem(
id,
start,

View file

@ -1383,7 +1383,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
rhs = rhs.getTypeSymbol().getTypeInfo();
}
if( !lhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) &&
if( !lhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) ||
!rhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) )
{
handleProblem( scope, IProblem.SEMANTIC_INVALID_CONVERSION_TYPE, null );