public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60262] New: explicit destructor call to destructor of Base accepted without using a qualified-id
@ 2014-02-18 11:59 filip.roseen at gmail dot com
  2014-08-22  3:01 ` [Bug c++/60262] explicit destructor call via Derived " potswa at mac dot com
  2014-12-14  0:09 ` ville.voutilainen at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: filip.roseen at gmail dot com @ 2014-02-18 11:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60262

            Bug ID: 60262
           Summary: explicit destructor call to destructor of Base
                    accepted without using a qualified-id
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: filip.roseen at gmail dot com

Created attachment 32160
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32160&action=edit
testcase.cpp

struct Base { };
struct Derived : Base { };

int main () {
  Derived * ptr = new Derived;

  ptr->~Base (); // illegal

  // ...
}

--------------------------------------------------------------------------------

gcc (incorrectly) accepts the above, while clang and icc (among others)
correctly issues a diagnostic saying that the statement marked `// illegal` is
illformed.

Destructors are not inherited and with this the destructor of `Base` is not
found via `ptr->~Base`, as can be read about under [class.virtual]p6:

  "Even though destructors are not inherited, <snip />"

This is not to be confused with a qualified explicit destructor call such as
`ptr->Base::~Base ()`, this is correctly accepted and is legal according to
several sections in the standard, including [class.dtor]p13.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/60262] explicit destructor call via Derived to destructor of Base accepted without using a qualified-id
  2014-02-18 11:59 [Bug c++/60262] New: explicit destructor call to destructor of Base accepted without using a qualified-id filip.roseen at gmail dot com
@ 2014-08-22  3:01 ` potswa at mac dot com
  2014-12-14  0:09 ` ville.voutilainen at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: potswa at mac dot com @ 2014-08-22  3:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60262

David Krauss <potswa at mac dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |potswa at mac dot com

--- Comment #1 from David Krauss <potswa at mac dot com> ---
*** Bug 62221 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/60262] explicit destructor call via Derived to destructor of Base accepted without using a qualified-id
  2014-02-18 11:59 [Bug c++/60262] New: explicit destructor call to destructor of Base accepted without using a qualified-id filip.roseen at gmail dot com
  2014-08-22  3:01 ` [Bug c++/60262] explicit destructor call via Derived " potswa at mac dot com
@ 2014-12-14  0:09 ` ville.voutilainen at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14  0:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60262

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-14
                 CC|                            |ville.voutilainen at gmail dot com
     Ever confirmed|0                           |1
      Known to fail|                            |4.9.1, 5.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-14  0:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-18 11:59 [Bug c++/60262] New: explicit destructor call to destructor of Base accepted without using a qualified-id filip.roseen at gmail dot com
2014-08-22  3:01 ` [Bug c++/60262] explicit destructor call via Derived " potswa at mac dot com
2014-12-14  0:09 ` ville.voutilainen at gmail dot com

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).