diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2010-04-08 16:38:48 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2010-04-08 16:38:48 +0000 |
commit | 9ab14541716928894821cf5d53d6b4c95ffdf3a3 (patch) | |
tree | 0e5efebde18104f9a50180afec737447bdc524b1 /test | |
parent | 461e326e74fa840945330a04df33b1180b08ddc0 (diff) |
Make CXXScopeSpec invalid when incomplete, and propagate that into any
Declarator that depends on it. This fixes several redundant errors and bad
recoveries.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CXX/temp/temp.spec/temp.explicit/p3.cpp | 16 | ||||
-rw-r--r-- | test/SemaCXX/nested-name-spec.cpp | 8 | ||||
-rw-r--r-- | test/SemaTemplate/instantiate-function-params.cpp | 3 | ||||
-rw-r--r-- | test/SemaTemplate/instantiate-typedef.cpp | 3 | ||||
-rw-r--r-- | test/SemaTemplate/typename-specifier.cpp | 15 |
5 files changed, 17 insertions, 28 deletions
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp index e30f046c2b..e9758bcdec 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp @@ -8,12 +8,11 @@ template void f0(int); // okay // A definition of the class or class template containing a member function // template shall be in scope at the point of the explicit instantiation of // the member function template. -struct X0; // expected-note 3{{forward declaration}} -template<typename> struct X1; // expected-note 8{{declared here}} +struct X0; // expected-note {{forward declaration}} +template<typename> struct X1; // expected-note 5{{declared here}} -// FIXME: Repeated diagnostics here! -template void X0::f0<int>(int); // expected-error 3{{incomplete type}} // expected-error{{invalid token after top level declarator}} -template void X1<int>::f0<int>(int); // expected-error 3{{implicit instantiation of undefined template}} // expected-error{{invalid token after top level declarator}} +template void X0::f0<int>(int); // expected-error {{incomplete type}} +template void X1<int>::f0<int>(int); // expected-error {{implicit instantiation of undefined template}} // A definition of a class template or class member template shall be in scope // at the point of the explicit instantiation of the class template or class @@ -33,11 +32,10 @@ template struct X2<int>::Inner<float>; // expected-error{{explicit instantiation // A definition of a class template shall be in scope at the point of an // explicit instantiation of a member function or a static data member of the // class template. -template void X1<int>::f1(int); // expected-error 2{{undefined template}} \ - // expected-error{{does not refer}} +template void X1<int>::f1(int); // expected-error {{undefined template}} +template void X1<int>::f1<int>(int); // expected-error {{undefined template}} -template int X1<int>::member; // expected-error 2{{undefined template}} \ - // expected-error{{does not refer}} +template int X1<int>::member; // expected-error {{undefined template}} // A definition of a member class of a class template shall be in scope at the // point of an explicit instantiation of the member class. diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index c6b11cfefe..cff04ab17a 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -165,8 +165,7 @@ void ::global_func2(int) { } // expected-error{{definition or redeclaration of ' void N::f() { } // okay struct Y; // expected-note{{forward declaration of 'Y'}} -Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}} \ - // expected-error{{no type named 'foo' in}} +Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}} X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \ // expected-error{{C++ requires a type specifier for all declarations}} \ @@ -224,9 +223,8 @@ namespace test2 { // PR6259, invalid case namespace test3 { - // FIXME: this should really only trigger once - class A; // expected-note 2 {{forward declaration}} + class A; // expected-note {{forward declaration}} void foo(const char *path) { - A::execute(path); // expected-error 2 {{incomplete type 'test3::A' named in nested name specifier}} + A::execute(path); // expected-error {{incomplete type 'test3::A' named in nested name specifier}} } } diff --git a/test/SemaTemplate/instantiate-function-params.cpp b/test/SemaTemplate/instantiate-function-params.cpp index ea8dd70619..cfca020aad 100644 --- a/test/SemaTemplate/instantiate-function-params.cpp +++ b/test/SemaTemplate/instantiate-function-params.cpp @@ -29,8 +29,7 @@ template < typename TT > struct ForwardIterator : I typedef instantiate< & requirement_<void(*)(usage_requirements<ForwardIterator> x)>::failed> boost_concept_check2; // expected-note 2 {{in instantiation}} }; -typedef instantiate< &requirement_<void(*)(ForwardIterator<char*> x)>::failed> boost_concept_checkX; // expected-error{{no member named}} \ -// expected-note 6{{in instantiation}} +typedef instantiate< &requirement_<void(*)(ForwardIterator<char*> x)>::failed> boost_concept_checkX;// expected-note 6{{in instantiation}} template<typename T> struct X0 { }; template<typename R, typename A1> struct X0<R(A1 param)> { }; diff --git a/test/SemaTemplate/instantiate-typedef.cpp b/test/SemaTemplate/instantiate-typedef.cpp index bb168a1c93..4e6cd24111 100644 --- a/test/SemaTemplate/instantiate-typedef.cpp +++ b/test/SemaTemplate/instantiate-typedef.cpp @@ -11,6 +11,5 @@ add_pointer<float>::type test2(int * ptr) { return ptr; // expected-error{{cannot initialize return object of type 'add_pointer<float>::type' (aka 'float *') with an lvalue of type 'int *'}} } -add_pointer<int&>::type // expected-note{{in instantiation of template class 'add_pointer<int &>' requested here}} \ -// expected-error {{no type named 'type' in 'add_pointer<int &>'}} +add_pointer<int&>::type // expected-note{{in instantiation of template class 'add_pointer<int &>' requested here}} test3(); diff --git a/test/SemaTemplate/typename-specifier.cpp b/test/SemaTemplate/typename-specifier.cpp index 42766a0620..3f6fe343f5 100644 --- a/test/SemaTemplate/typename-specifier.cpp +++ b/test/SemaTemplate/typename-specifier.cpp @@ -42,13 +42,10 @@ namespace N { } N::X<N::A>::type *ip4 = &i; -N::X<N::B>::type *ip5 = &i; // expected-note{{in instantiation of template class 'N::X<N::B>' requested here}} \ -// expected-error{{no type named 'type' in}} -N::X<N::C>::type *ip6 = &i; // expected-note{{in instantiation of template class 'N::X<N::C>' requested here}} \ -// expected-error{{no type named 'type' in}} +N::X<N::B>::type *ip5 = &i; // expected-note{{in instantiation of template class 'N::X<N::B>' requested here}} +N::X<N::C>::type *ip6 = &i; // expected-note{{in instantiation of template class 'N::X<N::C>' requested here}} -N::X<int>::type fail1; // expected-note{{in instantiation of template class 'N::X<int>' requested here}} \ -// expected-error{{no type named 'type' in}} +N::X<int>::type fail1; // expected-note{{in instantiation of template class 'N::X<int>' requested here}} template<typename T> struct Y { @@ -69,7 +66,5 @@ struct C { }; ::Y<A>::type ip7 = &i; -::Y<B>::type ip8 = &i; // expected-note{{in instantiation of template class 'Y<B>' requested here}} \ -// expected-error{{no type named 'type' in}} -::Y<C>::type ip9 = &i; // expected-note{{in instantiation of template class 'Y<C>' requested here}} \ -// expected-error{{no type named 'type' in}} +::Y<B>::type ip8 = &i; // expected-note{{in instantiation of template class 'Y<B>' requested here}} +::Y<C>::type ip9 = &i; // expected-note{{in instantiation of template class 'Y<C>' requested here}} |