From adf20e84c7af767214cfc7d1a92cb575925d24a4 Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Tue, 10 May 2005 15:13:14 +0000 Subject: [PATCH] update AST spec tests --- .../tests/ast2/AST2CPPSpecFailingTest.java | 47 ------------------ .../parser/tests/ast2/AST2CPPSpecTest.java | 48 +++++++++++++++++++ 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 @@ -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 { 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 @@ -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;