aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-14 22:17:06 +0000
committerChris Lattner <sabre@nondot.org>2009-04-14 22:17:06 +0000
commitf4382f50b7ab9f445c3f5b3ddaa59e6da25ea3bb (patch)
treec40a54645a3b931b525d2f33f0a8ff0903b4f014 /test
parent17fc223395d51be582fc666bb6ea21bd1dff26dc (diff)
Make the implicit-int handling error recovery stuff handle C++
nested name specifiers. Now we emit stuff like: t.cpp:8:13: error: unknown type name 'X' static foo::X P; ~~~~ ^ instead of: t.cpp:8:16: error: invalid token after top level declarator static foo::X P; ^ This is inspired by a really awful error message I got from g++ when I misspelt diag::kind as diag::Kind. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69086 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/SemaCXX/namespace.cpp11
-rw-r--r--test/SemaCXX/nested-name-spec.cpp6
-rw-r--r--test/SemaTemplate/instantiate-typedef.cpp4
-rw-r--r--test/SemaTemplate/nested-name-spec-template.cpp5
-rw-r--r--test/SemaTemplate/typename-specifier.cpp10
5 files changed, 23 insertions, 13 deletions
diff --git a/test/SemaCXX/namespace.cpp b/test/SemaCXX/namespace.cpp
index 24a0a4603d..592ca30790 100644
--- a/test/SemaCXX/namespace.cpp
+++ b/test/SemaCXX/namespace.cpp
@@ -56,3 +56,14 @@ namespace S1 {
}
namespace B {} // expected-error {{redefinition of 'B' as different kind of symbol}}
+
+
+namespace foo {
+ enum x {
+ Y
+ };
+}
+
+static foo::x test1; // ok
+
+static foo::X test2; // typo: expected-error {{unknown type name 'X'}}
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp
index 29fa001e0f..4c3ecee090 100644
--- a/test/SemaCXX/nested-name-spec.cpp
+++ b/test/SemaCXX/nested-name-spec.cpp
@@ -13,8 +13,8 @@ namespace A {
}
A:: ; // expected-error {{expected unqualified-id}}
-::A::ax::undef ex3; // expected-error {{expected a class or namespace}} expected-error {{invalid token after top level declarator}}
-A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}} expected-error {{invalid token after top level declarator}}
+::A::ax::undef ex3; // expected-error {{expected a class or namespace}} expected-error {{unknown type name 'undef'}}
+A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}} expected-error {{unknown type name 'undef2'}}
int A::C::Ag1() { return 0; }
@@ -166,7 +166,7 @@ void N::f() { } // okay
struct Y; // expected-note{{forward declaration of 'struct Y'}}
Y::foo y; // expected-error{{incomplete type 'struct Y' named in nested name specifier}} \
- // FIXME: ugly: expected-error{{invalid token after top level declarator}}
+ // expected-error{{unknown type name 'foo'}}
X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \
// expected-error{{C++ requires a type specifier for all declarations}} \
diff --git a/test/SemaTemplate/instantiate-typedef.cpp b/test/SemaTemplate/instantiate-typedef.cpp
index abdc37a062..c1355fca8d 100644
--- a/test/SemaTemplate/instantiate-typedef.cpp
+++ b/test/SemaTemplate/instantiate-typedef.cpp
@@ -11,5 +11,5 @@ add_pointer<float>::type test2(int * ptr) {
return ptr; // expected-error{{incompatible type returning 'int *', expected 'add_pointer<float>::type' (aka 'float *')}}
}
-add_pointer<int&>::type // expected-note{{in instantiation of template class 'struct add_pointer<int &>' requested here}}
-test3(); // FIXME: expected-error{{invalid token after top level declarator}}
+add_pointer<int&>::type // expected-note{{in instantiation of template class 'struct add_pointer<int &>' requested here}} expected-error {{unknown type name 'type'}}
+test3();
diff --git a/test/SemaTemplate/nested-name-spec-template.cpp b/test/SemaTemplate/nested-name-spec-template.cpp
index 7805040048..a5aa2dcb52 100644
--- a/test/SemaTemplate/nested-name-spec-template.cpp
+++ b/test/SemaTemplate/nested-name-spec-template.cpp
@@ -2,7 +2,7 @@
namespace N {
namespace M {
- template<typename T> struct Promote; // expected-note{{previous definition is here}}
+ template<typename T> struct Promote;
template<> struct Promote<short> {
typedef int type;
@@ -32,8 +32,7 @@ N::M::template; // expected-error{{expected template name after 'template' keywo
// expected-error{{expected unqualified-id}}
N::M::template Promote; // expected-error{{expected '<' after 'template Promote' in nested name specifier}} \
-// expected-error{{C++ requires a type specifier for all declarations}} \
-// expected-error{{redefinition of 'Promote' as different kind of symbol}}
+// expected-error{{C++ requires a type specifier for all declarations}}
namespace N {
template<typename T> struct A;
diff --git a/test/SemaTemplate/typename-specifier.cpp b/test/SemaTemplate/typename-specifier.cpp
index d15dbbc6e9..d3fca3eaca 100644
--- a/test/SemaTemplate/typename-specifier.cpp
+++ b/test/SemaTemplate/typename-specifier.cpp
@@ -42,12 +42,12 @@ namespace N {
N::X<N::A>::type *ip4 = &i;
N::X<N::B>::type *ip5 = &i; // expected-note{{in instantiation of template class 'struct N::X<struct N::B>' requested here}} \
-// FIXME: expected-error{{invalid token after top level declarator}}
+// expected-error{{unknown type name 'type'}}
N::X<N::C>::type *ip6 = &i; // expected-note{{in instantiation of template class 'struct N::X<struct N::C>' requested here}} \
-// FIXME: expected-error{{invalid token after top level declarator}}
+// expected-error{{unknown type name 'type'}}
N::X<int>::type fail1; // expected-note{{in instantiation of template class 'struct N::X<int>' requested here}} \
-// FIXME: expected-error{{invalid token after top level declarator}}
+// expected-error{{unknown type name 'type'}}
template<typename T>
struct Y {
@@ -69,6 +69,6 @@ struct C {
::Y<A>::type ip7 = &i;
::Y<B>::type ip8 = &i; // expected-note{{in instantiation of template class 'struct Y<struct B>' requested here}} \
-// FIXME: expected-error{{invalid token after top level declarator}}
+// expected-error{{unknown type name 'type'}}
::Y<C>::type ip9 = &i; // expected-note{{in instantiation of template class 'struct Y<struct C>' requested here}} \
-// FIXME: expected-error{{invalid token after top level declarator}}
+// expected-error{{unknown type name 'type'}}