diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/SemaCXX/typeid.cpp | 8 | ||||
-rw-r--r-- | test/SemaTemplate/instantiate-expr-4.cpp | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/test/SemaCXX/typeid.cpp b/test/SemaCXX/typeid.cpp index 4340310575..7960cac783 100644 --- a/test/SemaCXX/typeid.cpp +++ b/test/SemaCXX/typeid.cpp @@ -14,3 +14,11 @@ void g() { (void)typeid(int); } + +struct X; // expected-note 3{{forward declaration}} + +void g1(X &x) { + (void)typeid(X); // expected-error{{'typeid' of incomplete type 'struct X'}} + (void)typeid(X&); // expected-error{{'typeid' of incomplete type 'struct X'}} + (void)typeid(x); // expected-error{{'typeid' of incomplete type 'struct X'}} +} diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp index 99bbbf7a16..c524e958f8 100644 --- a/test/SemaTemplate/instantiate-expr-4.cpp +++ b/test/SemaTemplate/instantiate-expr-4.cpp @@ -133,7 +133,7 @@ struct Throw1 { } }; -struct Incomplete; // expected-note{{forward}} +struct Incomplete; // expected-note 2{{forward}} template struct Throw1<int>; template struct Throw1<int*>; @@ -143,7 +143,6 @@ template struct Throw1<Incomplete*>; // expected-note{{instantiation}} // typeid expressions // --------------------------------------------------------------------- -// FIXME: This should really include <typeinfo>, but we don't have that yet. namespace std { class type_info; } @@ -154,7 +153,7 @@ struct TypeId0 { if (ptr) return typeid(ptr); else - return typeid(T); + return typeid(T); // expected-error{{'typeid' of incomplete type 'struct Incomplete'}} } }; @@ -163,7 +162,7 @@ struct Abstract { }; template struct TypeId0<int>; -template struct TypeId0<Incomplete>; +template struct TypeId0<Incomplete>; // expected-note{{instantiation of member function}} template struct TypeId0<Abstract>; // --------------------------------------------------------------------- |