mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
update AST spec tests
This commit is contained in:
parent
e2e8b4439d
commit
adf20e84c7
2 changed files with 48 additions and 47 deletions
|
@ -41,53 +41,6 @@ public class AST2CPPSpecFailingTest extends AST2SpecBaseTest {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
[--Start Example(CPP 3.2-5):
|
||||
// translation unit 1:
|
||||
struct X {
|
||||
X(int);
|
||||
X(int, int);
|
||||
};
|
||||
X::X(int = 0) { }
|
||||
class D: public X { };
|
||||
D d2; // X(int) called by D()
|
||||
// translation unit 2:
|
||||
struct X {
|
||||
X(int);
|
||||
X(int, int);
|
||||
};
|
||||
X::X(int = 0, int = 0) { }
|
||||
class D: public X { }; // X(int, int) called by D();
|
||||
// D()’s implicit definition
|
||||
// violates the ODR
|
||||
--End Example]
|
||||
*/
|
||||
public void test3_2s5() { // TODO raised bug 90602
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("// translation unit 1:\n"); //$NON-NLS-1$
|
||||
buffer.append("struct X {\n"); //$NON-NLS-1$
|
||||
buffer.append("X(int);\n"); //$NON-NLS-1$
|
||||
buffer.append("X(int, int);\n"); //$NON-NLS-1$
|
||||
buffer.append("};\n"); //$NON-NLS-1$
|
||||
buffer.append("X::X(int = 0) { }\n"); //$NON-NLS-1$
|
||||
buffer.append("class D: public X { };\n"); //$NON-NLS-1$
|
||||
buffer.append("D d2; // X(int) called by D()\n"); //$NON-NLS-1$
|
||||
buffer.append("// translation unit 2:\n"); //$NON-NLS-1$
|
||||
buffer.append("struct X {\n"); //$NON-NLS-1$
|
||||
buffer.append("X(int);\n"); //$NON-NLS-1$
|
||||
buffer.append("X(int, int);\n"); //$NON-NLS-1$
|
||||
buffer.append("};\n"); //$NON-NLS-1$
|
||||
buffer.append("X::X(int = 0, int = 0) { }\n"); //$NON-NLS-1$
|
||||
buffer.append("class D: public X { }; // X(int, int) called by D();\n"); //$NON-NLS-1$
|
||||
buffer.append("// D()’s implicit definition\n"); //$NON-NLS-1$
|
||||
buffer.append("// violates the ODR\n"); //$NON-NLS-1$
|
||||
try{
|
||||
parse(buffer.toString(), ParserLanguage.CPP, true, 0);
|
||||
assertTrue(false);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
[--Start Example(CPP 3.4.1-10):
|
||||
struct A {
|
||||
|
|
|
@ -179,6 +179,54 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
|
|||
parseCandCPP(buffer.toString(), true, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
[--Start Example(CPP 3.2-5):
|
||||
// translation unit 1:
|
||||
struct X {
|
||||
X(int);
|
||||
X(int, int);
|
||||
};
|
||||
X::X(int = 0) { }
|
||||
class D: public X { };
|
||||
D d2; // X(int) called by D()
|
||||
// translation unit 2:
|
||||
struct X {
|
||||
X(int);
|
||||
X(int, int);
|
||||
};
|
||||
X::X(int = 0, int = 0) { }
|
||||
class D: public X { }; // X(int, int) called by D();
|
||||
// D()’s implicit definition
|
||||
// violates the ODR
|
||||
--End Example]
|
||||
*/
|
||||
public void test3_2s5() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("// translation unit 1:\n"); //$NON-NLS-1$
|
||||
buffer.append("struct X {\n"); //$NON-NLS-1$
|
||||
buffer.append("X(int);\n"); //$NON-NLS-1$
|
||||
buffer.append("X(int, int);\n"); //$NON-NLS-1$
|
||||
buffer.append("};\n"); //$NON-NLS-1$
|
||||
buffer.append("X::X(int = 0) { }\n"); //$NON-NLS-1$
|
||||
buffer.append("class D: public X { };\n"); //$NON-NLS-1$
|
||||
buffer.append("D d2; // X(int) called by D()\n"); //$NON-NLS-1$
|
||||
|
||||
parse(buffer.toString(), ParserLanguage.CPP, true, 0);
|
||||
|
||||
buffer = new StringBuffer();
|
||||
buffer.append("// translation unit 2:\n"); //$NON-NLS-1$
|
||||
buffer.append("struct X {\n"); //$NON-NLS-1$
|
||||
buffer.append("X(int);\n"); //$NON-NLS-1$
|
||||
buffer.append("X(int, int);\n"); //$NON-NLS-1$
|
||||
buffer.append("};\n"); //$NON-NLS-1$
|
||||
buffer.append("X::X(int = 0, int = 0) { }\n"); //$NON-NLS-1$
|
||||
buffer.append("class D: public X { }; // X(int, int) called by D();\n"); //$NON-NLS-1$
|
||||
buffer.append("// D()’s implicit definition\n"); //$NON-NLS-1$
|
||||
buffer.append("// violates the ODR\n"); //$NON-NLS-1$
|
||||
|
||||
parse(buffer.toString(), ParserLanguage.CPP, true, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
[--Start Example(CPP 3.3-2):
|
||||
int j = 24;
|
||||
|
|
Loading…
Add table
Reference in a new issue