diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-11-10 08:36:09 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-11-10 08:36:09 +0100 |
commit | 3d9b2eb64f64c87952dd974a96e2756bdcf2e4b3 (patch) | |
tree | 9319bec3789d86a6c306bf63c392bc06557c2af8 /gcc/testsuite/g++.dg | |
parent | 49b5e2f6b50347329eaddd44becfec13633f940e (diff) | |
download | gcc-3d9b2eb64f64c87952dd974a96e2756bdcf2e4b3.zip gcc-3d9b2eb64f64c87952dd974a96e2756bdcf2e4b3.tar.gz gcc-3d9b2eb64f64c87952dd974a96e2756bdcf2e4b3.tar.bz2 |
re PR c++/32241 (ICE trying to call x.~X(); in a template)
PR c++/32241
* pt.c (tsubst_copy_and_build) <case COMPONENT_REF>: If object_type
is not scalar type, let finish_class_member_access_expr handle
diagnostics. Pass BIT_NOT_EXPR argument to
finish_pseudo_destructor_expr. Handle SCOPE_REF properly.
* g++.dg/template/pseudodtor3.C: New test.
From-SVN: r130066
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r-- | gcc/testsuite/g++.dg/template/pseudodtor3.C | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/pseudodtor3.C b/gcc/testsuite/g++.dg/template/pseudodtor3.C new file mode 100644 index 0000000..5f392f4 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pseudodtor3.C @@ -0,0 +1,43 @@ +// PR c++/32241 +// { dg-do compile } + +struct A +{ + typedef int T; + T &foo (); + A () { foo.~T (); } // { dg-error "does not have class type|expected" } +}; + +template <typename T> struct B +{ + T &foo (); + B () { foo.~T (); } // { dg-error "invalid use of member" } +}; + +B<int> b; + +template <typename T, typename S> struct C +{ + T t; + C () { t.~S (); } // { dg-error "is not of type" } +}; + +C<int, long int> c; + +template <typename T> struct D +{ + T t; + typedef long int U; + D () { t.~U (); } // { dg-error "is not of type" } +}; + +D<int> d; + +template <typename T> struct E +{ + T &foo (); + typedef long int U; + E () { foo.~U (); } // { dg-error "is not of type" } +}; + +E<int> e; |