mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
76947: [Parser] Declaration parsed as Expression
This commit is contained in:
parent
72b2f7aa1e
commit
a0bf3dad3b
3 changed files with 5 additions and 3 deletions
|
@ -962,7 +962,8 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
||||||
|
|
||||||
public void testBug39551B() throws Exception
|
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$
|
assertEquals( variable.getName(), "id"); //$NON-NLS-1$
|
||||||
assertTrue( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).isImaginary() );
|
assertTrue( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).isImaginary() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,8 @@ public class ParserProblemFactory extends BaseProblemFactory
|
||||||
if( checkBitmask( id, IProblem.INTERNAL_RELATED ) )
|
if( checkBitmask( id, IProblem.INTERNAL_RELATED ) )
|
||||||
return createInternalProblem( id, start, end, line, file, arg, warn, error );
|
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(
|
return super.createProblem(
|
||||||
id,
|
id,
|
||||||
start,
|
start,
|
||||||
|
|
|
@ -1383,7 +1383,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
rhs = rhs.getTypeSymbol().getTypeInfo();
|
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 ) )
|
!rhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) )
|
||||||
{
|
{
|
||||||
handleProblem( scope, IProblem.SEMANTIC_INVALID_CONVERSION_TYPE, null );
|
handleProblem( scope, IProblem.SEMANTIC_INVALID_CONVERSION_TYPE, null );
|
||||||
|
|
Loading…
Add table
Reference in a new issue