public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <20010417085356.15065.qmail@sourceware.cygnus.com> (raw)

>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 <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.

>How-To-Repeat:
#include <stdlib.h>

class class_1 {
  public:
    class_1(void) {};
    virtual ~class_1(void) {};
};

template<class Type> 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<int>();

    free(p);
  }
}

int main(void)
{
  class_1 v1;
  class_2<int> 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==


             reply	other threads:[~2001-04-17  1:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-17  1:56 guido [this message]
2002-10-30 18:20 bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010417085356.15065.qmail@sourceware.cygnus.com \
    --to=guido@cityweb.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).