mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Fixed Bug 84236 - variable sized array modifiers
This commit is contained in:
parent
3e9fe50bc3
commit
893ef31135
2 changed files with 13 additions and 1 deletions
|
@ -2804,4 +2804,16 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertEquals( ds.length, 1 );
|
||||
assertSame( ds[0], col.getName(11) );
|
||||
}
|
||||
|
||||
public void testBug84236() throws Exception
|
||||
{
|
||||
String code = "double maximum(double a[ ][*]);"; //$NON-NLS-1$
|
||||
IASTSimpleDeclaration d = (IASTSimpleDeclaration) parse( code, ParserLanguage.C ).getDeclarations()[0];
|
||||
IASTStandardFunctionDeclarator fd = (IASTStandardFunctionDeclarator) d.getDeclarators()[0];
|
||||
IASTParameterDeclaration p = fd.getParameters()[0];
|
||||
IASTArrayDeclarator a = (IASTArrayDeclarator) p.getDeclarator();
|
||||
ICASTArrayModifier star = (ICASTArrayModifier) a.getArrayModifiers()[1];
|
||||
assertTrue( star.isVariableSized() );
|
||||
|
||||
}
|
||||
}
|
|
@ -2082,7 +2082,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
int lastOffset = consume(IToken.tRBRACKET).getEndOffset();
|
||||
|
||||
IASTArrayModifier arrayMod = null;
|
||||
if (!(isStatic || isRestrict || isConst || isVolatile))
|
||||
if (!(isStatic || isRestrict || isConst || isVolatile || isVarSized ))
|
||||
arrayMod = createArrayModifier();
|
||||
else {
|
||||
ICASTArrayModifier temp = createCArrayModifier();
|
||||
|
|
Loading…
Add table
Reference in a new issue