Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java47
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java48
2 files changed, 48 insertions, 47 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java
index f42f190628e..67f58cd9d3b 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java
@@ -42,53 +42,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 {
typedef int AT;
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java
index f0719fa6bb4..742f60ee25a 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java
@@ -180,6 +180,54 @@ public class AST2CPPSpecTest 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() 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;
int main()

Back to the top