diff options
Diffstat (limited to 'test/SemaTemplate/virtual-member-functions.cpp')
-rw-r--r-- | test/SemaTemplate/virtual-member-functions.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/test/SemaTemplate/virtual-member-functions.cpp b/test/SemaTemplate/virtual-member-functions.cpp index a23bf4e..c2fc263 100644 --- a/test/SemaTemplate/virtual-member-functions.cpp +++ b/test/SemaTemplate/virtual-member-functions.cpp @@ -3,19 +3,17 @@ namespace PR5557 { template <class T> struct A { - A(); - virtual void anchor(); + A(); // expected-note{{instantiation}} virtual int a(T x); }; template<class T> A<T>::A() {} -template<class T> void A<T>::anchor() { } template<class T> int A<T>::a(T x) { return *x; // expected-error{{requires pointer operand}} } -void f(A<int> x) { - x.anchor(); // expected-note{{instantiation}} +void f() { + A<int> x; // expected-note{{instantiation}} } template<typename T> @@ -27,6 +25,24 @@ template<> void X<int>::f() { } } +// Like PR5557, but with a defined destructor instead of a defined constructor. +namespace PR5557_dtor { +template <class T> struct A { + A(); // Don't have an implicit constructor. + ~A(); // expected-note{{instantiation}} + virtual int a(T x); +}; +template<class T> A<T>::~A() {} + +template<class T> int A<T>::a(T x) { + return *x; // expected-error{{requires pointer operand}} +} + +void f() { + A<int> x; // expected-note{{instantiation}} +} +} + template<typename T> struct Base { virtual ~Base() { |