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

fix bug 98520

This commit is contained in:
Andrew Niefer 2005-06-20 19:06:02 +00:00
parent 08eb1c00e5
commit dd8c9f0af7
3 changed files with 34 additions and 29 deletions

View file

@ -10,11 +10,43 @@
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2;
import org.eclipse.cdt.core.parser.ParserLanguage;
/**
* @author dsteffle
*/
public class AST2CSpecFailingTest extends AST2SpecBaseTest {
/**
[--Start Example(C 6.7.7-6):
typedef signed int t;
typedef int plain;
struct tag {
unsigned t:4;
const t:5;
plain r:5;
};
t f(t (t));
long t;
--End Example]
*/
public void test6_7_7s6() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("typedef signed int t;\n"); //$NON-NLS-1$
buffer.append("typedef int plain;\n"); //$NON-NLS-1$
buffer.append("struct tag {\n"); //$NON-NLS-1$
buffer.append("unsigned t:4;\n"); //$NON-NLS-1$
buffer.append("const t:5;\n"); //$NON-NLS-1$
buffer.append("plain r:5;\n"); //$NON-NLS-1$
buffer.append("};\n"); //$NON-NLS-1$
buffer.append("t f(t (t));\n"); //$NON-NLS-1$
buffer.append("long t;\n"); //$NON-NLS-1$
try {
parse(buffer.toString(), ParserLanguage.C, true, 0);
assertTrue(false);
} catch (Exception e) {}
}
/**
[--Start Example(C 6.10.3.5-6):
#define str(s) # s

View file

@ -1254,33 +1254,6 @@ public class AST2CSpecTest extends AST2SpecBaseTest {
parseCandCPP(buffer.toString(), true, 0);
}
/**
[--Start Example(C 6.7.7-6):
typedef signed int t;
typedef int plain;
struct tag {
unsigned t:4;
const t:5;
plain r:5;
};
t f(t (t));
long t;
--End Example]
*/
public void test6_7_7s6() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("typedef signed int t;\n"); //$NON-NLS-1$
buffer.append("typedef int plain;\n"); //$NON-NLS-1$
buffer.append("struct tag {\n"); //$NON-NLS-1$
buffer.append("unsigned t:4;\n"); //$NON-NLS-1$
buffer.append("const t:5;\n"); //$NON-NLS-1$
buffer.append("plain r:5;\n"); //$NON-NLS-1$
buffer.append("};\n"); //$NON-NLS-1$
buffer.append("t f(t (t));\n"); //$NON-NLS-1$
buffer.append("long t;\n"); //$NON-NLS-1$
parse(buffer.toString(), ParserLanguage.C, true, 0);
}
/**
[--Start Example(C 6.7.7-7):
typedef void fv(int), (*pfv)(int);

View file

@ -1076,9 +1076,9 @@ public class CVisitor {
IASTNode parent = node.getParent();
if( parent instanceof IASTStandardFunctionDeclarator ){
parent = ((IASTDeclarator)parent).getParent();
if ( parent instanceof IASTFunctionDefinition ) {
if ( parent instanceof IASTFunctionDefinition )
return ((IASTCompoundStatement)((IASTFunctionDefinition)parent).getBody()).getScope();
}
return null;
}
}
else if( node instanceof IASTEnumerator ){