Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2007-08-04 01:11:53 +0000
committerAndrew Niefer2007-08-04 01:11:53 +0000
commit1bec4f8d34cd10376023d5bdb070c6c774a57350 (patch)
tree4d6957cc5d04542a066a25d87897d807afc7a2a3 /core/org.eclipse.cdt.core.tests
parent9577e25245be3c34cac15c86f3b272778d2ebfe6 (diff)
downloadorg.eclipse.cdt-1bec4f8d34cd10376023d5bdb070c6c774a57350.tar.gz
org.eclipse.cdt-1bec4f8d34cd10376023d5bdb070c6c774a57350.tar.xz
org.eclipse.cdt-1bec4f8d34cd10376023d5bdb070c6c774a57350.zip
bug 90683 - syntax errors in template argument
Diffstat (limited to 'core/org.eclipse.cdt.core.tests')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java44
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java41
2 files changed, 41 insertions, 44 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 d74169f8164..b96f0b4a302 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
@@ -176,31 +176,6 @@ public class AST2CPPSpecFailingTest extends AST2SpecBaseTest {
}
/**
- [--Start Example(CPP 8.2-4):
- template <class T>
- struct S {
- T *p;
- };
- S<int()> x; // typeid
- S<int(1)> y; // expression (illformed)
- --End Example]
- */
- public void test8_2s4() { // TODO raised bug 90632
- StringBuffer buffer = new StringBuffer();
- buffer.append("template <class T>\n"); //$NON-NLS-1$
- buffer.append("struct S {\n"); //$NON-NLS-1$
- buffer.append("T *p;\n"); //$NON-NLS-1$
- buffer.append("};\n"); //$NON-NLS-1$
- buffer.append("S<int()> x; // typeid\n"); //$NON-NLS-1$
- buffer.append("S<int(1)> y; // expression (illformed)\n"); //$NON-NLS-1$
- try {
- parse(buffer.toString(), ParserLanguage.CPP, true, 0);
- assertTrue(false);
- } catch (Exception e) {
- }
- }
-
- /**
[--Start Example(CPP 8.2-7a):
class C { };
void f(int(C)) { } // void f(int (*fp)(C c)) { }
@@ -559,25 +534,6 @@ public class AST2CPPSpecFailingTest extends AST2SpecBaseTest {
} catch (Exception e) {
}
}
-
- /**
- [--Start Example(CPP 14.5.5.1-8b):
- // Illformed, no diagnostic required
- template <int I> void f(A<I>, A<I+10>);
- template <int I> void f(A<I>, A<I+1+2+3+4>);
- --End Example]
- */
- public void test14_5_5_1s8b() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("// Illformed, no diagnostic required\n"); //$NON-NLS-1$
- buffer.append("template <int I> void f(A<I>, A<I+10>);\n"); //$NON-NLS-1$
- buffer.append("template <int I> void f(A<I>, A<I+1+2+3+4>);\n"); //$NON-NLS-1$
- try {
- parse(buffer.toString(), ParserLanguage.CPP, false, 0);
- assertTrue(false);
- } catch (Exception e) {
- }
- }
/**
[--Start Example(CPP 14.8.1-4):
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 c13bab3ff18..0c7ed94ad6e 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
@@ -3363,6 +3363,29 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
}
/**
+ [--Start Example(CPP 8.2-4):
+ template <class T>
+ struct S {
+ T *p;
+ };
+ S<int()> x; // typeid
+ S<int(1)> y; // expression (illformed)
+ --End Example]
+ */
+ public void test8_2s4() throws Exception {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("template <class T>\n"); //$NON-NLS-1$
+ buffer.append("struct S {\n"); //$NON-NLS-1$
+ buffer.append("T *p;\n"); //$NON-NLS-1$
+ buffer.append("};\n"); //$NON-NLS-1$
+ buffer.append("S<int()> x; // typeid\n"); //$NON-NLS-1$
+ buffer.append("S<int(1)> y; // expression (illformed)\n"); //$NON-NLS-1$
+
+ //test is only for syntax, semantics are not checked here.
+ parse(buffer.toString(), ParserLanguage.CPP, true, 0);
+ }
+
+ /**
[--Start Example(CPP 8.2-5):
void foo()
{
@@ -9450,6 +9473,24 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
parse(buffer.toString(), ParserLanguage.CPP, true, 0);
}
+
+ /**
+ [--Start Example(CPP 14.5.5.1-8b):
+ // Illformed, no diagnostic required
+ template <int I> void f(A<I>, A<I+10>);
+ template <int I> void f(A<I>, A<I+1+2+3+4>);
+ --End Example]
+ */
+ public void test14_5_5_1s8b() throws Exception {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("// Illformed, no diagnostic required\n"); //$NON-NLS-1$
+ buffer.append("template <int I> void f(A<I>, A<I+10>);\n"); //$NON-NLS-1$
+ buffer.append("template <int I> void f(A<I>, A<I+1+2+3+4>);\n"); //$NON-NLS-1$
+
+ //test is only for syntax, semantics are not checked here.
+ parse(buffer.toString(), ParserLanguage.CPP, false, 0);
+ }
+
/**
[--Start Example(CPP 14.5.5.2-5):
template<class T> struct A { A(); };

Back to the top