diff options
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r-- | clang/test/SemaCXX/destructor.cpp | 6 | ||||
-rw-r--r-- | clang/test/SemaCXX/vtable-instantiation.cc | 20 |
2 files changed, 23 insertions, 3 deletions
diff --git a/clang/test/SemaCXX/destructor.cpp b/clang/test/SemaCXX/destructor.cpp index a33aa5e05e5..72268bd43ac 100644 --- a/clang/test/SemaCXX/destructor.cpp +++ b/clang/test/SemaCXX/destructor.cpp @@ -100,11 +100,11 @@ namespace test6 { T::deleteIt(p); // expected-error {{type 'int' cannot be used prior to '::'}} } - virtual ~A() {} // expected-note {{in instantiation of member function 'test6::A<int>::operator delete' requested here}} + virtual ~A() {} }; - class B : A<int> { B(); }; - B::B() {} // expected-note {{in instantiation of member function 'test6::A<int>::~A' requested here}} + class B : A<int> { B(); }; // expected-note {{in instantiation of member function 'test6::A<int>::operator delete' requested here}} + B::B() {} } // Make sure classes are marked invalid when they have invalid diff --git a/clang/test/SemaCXX/vtable-instantiation.cc b/clang/test/SemaCXX/vtable-instantiation.cc new file mode 100644 index 00000000000..5a13d9505b3 --- /dev/null +++ b/clang/test/SemaCXX/vtable-instantiation.cc @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// PR8640 + +template<class T1> struct C1 { + virtual void c1() { + T1 t1 = 3; // expected-error {{cannot initialize a variable}} + } +}; + +template<class T2> struct C2 { + void c2() { + new C1<T2>(); // expected-note {{in instantiation of member function}} + } +}; + +void f() { + C2<int*> c2; + c2.c2(); // expected-note {{in instantiation of member function}} +} + |