diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 12050699c92..1c557bd0d11 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2001-02-17 Mark Mitchell + + * call.c (check_dtor_name): Handle template names correctly. + 2001-02-16 Jason Merrill * cp-tree.h (DECL_USE_VTT_PARM): Remove. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f11929b095e..184ffeb6466 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -192,6 +192,15 @@ check_dtor_name (basetype, name) else name = get_type_value (name); } + /* In the case of: + + template struct S { ~S(); }; + int i; + i.~S(); + + NAME will be a class template. */ + else if (DECL_CLASS_TEMPLATE_P (name)) + return 0; else my_friendly_abort (980605); diff --git a/gcc/testsuite/g++.old-deja/g++.other/dtor13.C b/gcc/testsuite/g++.old-deja/g++.other/dtor13.C new file mode 100644 index 00000000000..49c02ec1e78 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/dtor13.C @@ -0,0 +1,10 @@ +// Build don't link: +// Origin: Mark Mitchell + +template struct S { ~S(); }; +int i; + +void f () +{ + i.~S(); // ERROR - invalid destructor call. +}