diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/SemaCXX/nested-name-spec.cpp | 8 | ||||
-rw-r--r-- | test/SemaTemplate/instantiate-typedef.cpp | 15 |
2 files changed, 21 insertions, 2 deletions
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index 2b6de3363b..f75b279a44 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -1,5 +1,4 @@ -// RUN: clang -fsyntax-only -verify -std=c++98 %s -// fails due to exact diagnostic matching +// RUN: clang -fsyntax-only -std=c++98 -verify %s namespace A { struct C { static int cx; @@ -151,5 +150,10 @@ void ::global_func2(int) { } // expected-error{{definition or redeclaration of ' 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}} + X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \ // expected-error{{expected function body after function declarator}} + diff --git a/test/SemaTemplate/instantiate-typedef.cpp b/test/SemaTemplate/instantiate-typedef.cpp new file mode 100644 index 0000000000..8ecee50502 --- /dev/null +++ b/test/SemaTemplate/instantiate-typedef.cpp @@ -0,0 +1,15 @@ +// RUN: clang -fsyntax-only -verify %s + +template<typename T> +struct add_pointer { + typedef T* type; // expected-error{{'type' declared as a pointer to a reference}} +}; + +add_pointer<int>::type test1(int * ptr) { return ptr; } + +add_pointer<float>::type test2(int * ptr) { + return ptr; // expected-error{{incompatible type returning 'int *', expected '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}} |