From mboxrd@z Thu Jan 1 00:00:00 1970 From: guido@cityweb.de To: gcc-gnats@gcc.gnu.org Subject: c++/2567: gcc: incorrect calling of template class destructor produces internal error Date: Tue, 17 Apr 2001 01:56:00 -0000 Message-id: <20010417085356.15065.qmail@sourceware.cygnus.com> X-SW-Source: 2001-04/msg00301.html List-Id: >Number: 2567 >Category: c++ >Synopsis: gcc: incorrect calling of template class destructor produces internal error >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: ice-on-illegal-code >Submitter-Id: net >Arrival-Date: Tue Apr 17 01:56:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Guido Pieper >Release: gcc version 2.95.2 19991024 (release) >Organization: >Environment: Linux Kernel 2.2.16 (SuSE Linux 7.0) >Description: "gcc -Wall x.cpp" prints this error message: x.cpp: In function `void freeclass(class_1 *)': x.cpp:20: Internal compiler error 980605. x.cpp:20: Please submit a full bug report. x.cpp:20: See for instructions. >How-To-Repeat: #include class class_1 { public: class_1(void) {}; virtual ~class_1(void) {}; }; template class class_2 { public: class_2(void) {}; virtual ~class_2(void) {}; }; void freeclass(class_1 *p) { if (p) { // Internal compiler error 980605: p->~class_2(); // correct: // p->~class_1(); // correct error message: // p->~class_2(); free(p); } } int main(void) { class_1 v1; class_2 v2; // same error: // v1.~class_2(); return(0); } >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="x.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="x.cpp" I2luY2x1ZGUgPHN0ZGxpYi5oPgoKY2xhc3MgY2xhc3NfMSB7CiAgcHVibGljOgogICAgY2xhc3Nf MSh2b2lkKSB7fTsKICAgIHZpcnR1YWwgfmNsYXNzXzEodm9pZCkge307Cn07Cgp0ZW1wbGF0ZTxj bGFzcyBUeXBlPiBjbGFzcyBjbGFzc18yIHsKICBwdWJsaWM6CiAgICBjbGFzc18yKHZvaWQpIHt9 OwogICAgdmlydHVhbCB+Y2xhc3NfMih2b2lkKSB7fTsKfTsKCnZvaWQgZnJlZWNsYXNzKGNsYXNz XzEgKnApCnsKICBpZiAocCkgewogIAogICAgLy8gSW50ZXJuYWwgY29tcGlsZXIgZXJyb3IgOTgw NjA1OgogICAgcC0+fmNsYXNzXzIoKTsKCiAgICAvLyBjb3JyZWN0OgogICAgLy8gcC0+fmNsYXNz XzEoKTsKCiAgICAvLyBjb3JyZWN0IGVycm9yIG1lc3NhZ2U6CiAgICAvLyBwLT5+Y2xhc3NfMjxp bnQ+KCk7CgogICAgZnJlZShwKTsKICB9Cn0KCmludCBtYWluKHZvaWQpCnsKICBjbGFzc18xIHYx OwogIGNsYXNzXzI8aW50PiB2MjsKICAvLyBzYW1lIGVycm9yOgogIC8vIHYxLn5jbGFzc18yKCk7 CiAgcmV0dXJuKDApOwp9Cg==