diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
| commit | 06d4ba388873e6d1cfa9cd715a8935ecc8cd2097 (patch) | |
| tree | 3eb853da77d46cc77c4b017525a422f9ddb1385b /test/SemaTemplate/virtual-member-functions.cpp | |
| parent | 30d791273d07fac9c0c1641a0731191bca6e8606 (diff) | |
Notes
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 a23bf4e3ee5e..c2fc2634edd6 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() { |
