public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19243] New: Misleading error message for ill-formed explicit destructor invocation
@ 2005-01-03 20:44 austern at apple dot com
2005-01-03 20:49 ` [Bug c++/19243] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: austern at apple dot com @ 2005-01-03 20:44 UTC (permalink / raw)
To: gcc-bugs
gcc 4.0 gives an error message for the following file:
struct X {
void destroy_me() { X::~X(); }
};
This code is incorrect, so an error message is appropriate. However, the error message isn't likely to be
useful.
The error message we get is:
foo.cc: In member function 'void X::destroy_me()':
foo.cc:2: error: '~X' is not a member of 'X'
But that's not the real problem. Obviously ~X() is a member of X. The real problem is that this is the
wrong syntax for an explicit destructor invocation: the user should have written this->X::~X(), not X::
~X() by itself.
(See the formal grammar for postfix expressions in 5.2/1, and the discussion of pseudo-destructor
calls in 5.2.4, to see why this code is incorrect.)
--
Summary: Misleading error message for ill-formed explicit
destructor invocation
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: austern at apple dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: all
GCC host triplet: all
GCC target triplet: all
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19243
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/19243] Misleading error message for ill-formed explicit destructor invocation
2005-01-03 20:44 [Bug c++/19243] New: Misleading error message for ill-formed explicit destructor invocation austern at apple dot com
@ 2005-01-03 20:49 ` pinskia at gcc dot gnu dot org
2005-01-03 20:52 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-03 20:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-03 20:49 -------
Hmm, I think this is valid code and should not be rejected, see DR 272 and PR 12333 (which I think this
is a dup of).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19243
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/19243] Misleading error message for ill-formed explicit destructor invocation
2005-01-03 20:44 [Bug c++/19243] New: Misleading error message for ill-formed explicit destructor invocation austern at apple dot com
2005-01-03 20:49 ` [Bug c++/19243] " pinskia at gcc dot gnu dot org
@ 2005-01-03 20:52 ` pinskia at gcc dot gnu dot org
2005-01-03 20:55 ` austern at apple dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-03 20:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-03 20:52 -------
Looking further it is a dup of bug 12333. But I also note this is only invalid in C++-98 and not in
C++-0x because of that DR being in WP status.
*** This bug has been marked as a duplicate of 12333 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19243
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/19243] Misleading error message for ill-formed explicit destructor invocation
2005-01-03 20:44 [Bug c++/19243] New: Misleading error message for ill-formed explicit destructor invocation austern at apple dot com
2005-01-03 20:49 ` [Bug c++/19243] " pinskia at gcc dot gnu dot org
2005-01-03 20:52 ` pinskia at gcc dot gnu dot org
@ 2005-01-03 20:55 ` austern at apple dot com
2005-01-03 21:58 ` giovannibajo at libero dot it
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: austern at apple dot com @ 2005-01-03 20:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From austern at apple dot com 2005-01-03 20:55 -------
Subject: Re: Misleading error message for ill-formed explicit destructor invocation
On Jan 3, 2005, at 12:49 PM, pinskia at gcc dot gnu dot org wrote:
>
> ------- Additional Comments From pinskia at gcc dot gnu dot org
> 2005-01-03 20:49 -------
> Hmm, I think this is valid code and should not be rejected, see DR 272
> and PR 12333 (which I think this
> is a dup of).
DR 272 is in "WP" status, meaning it's part of the working paper for
C++0x. It's not part of the International Standard ISO/IEC 14882:2003.
I couldn't find anything in the standard saying that it was acceptable
to write an explicit destructor call using a qualified-id. Did I miss
something?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19243
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/19243] Misleading error message for ill-formed explicit destructor invocation
2005-01-03 20:44 [Bug c++/19243] New: Misleading error message for ill-formed explicit destructor invocation austern at apple dot com
` (2 preceding siblings ...)
2005-01-03 20:55 ` austern at apple dot com
@ 2005-01-03 21:58 ` giovannibajo at libero dot it
2005-01-05 5:21 ` austern at apple dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2005-01-03 21:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2005-01-03 21:58 -------
No, you are right, this is a diagnostic problem. Andrew thought it was
referred to the legality of the code instead.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Keywords| |diagnostic
Resolution|DUPLICATE |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19243
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/19243] Misleading error message for ill-formed explicit destructor invocation
2005-01-03 20:44 [Bug c++/19243] New: Misleading error message for ill-formed explicit destructor invocation austern at apple dot com
` (3 preceding siblings ...)
2005-01-03 21:58 ` giovannibajo at libero dot it
@ 2005-01-05 5:21 ` austern at apple dot com
2005-05-31 17:11 ` pinskia at gcc dot gnu dot org
2005-06-19 14:27 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: austern at apple dot com @ 2005-01-05 5:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From austern at apple dot com 2005-01-05 05:21 -------
Nope, I was wrong. DR272 only affects a nonnormative note. I've checked with Mike Miller, and he
pointed me to the appropriate normative text that implies that X::~X() within a member function applies
to the destructor. This is a rejects-valid bug, not just a bad diagnostic.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19243
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/19243] Misleading error message for ill-formed explicit destructor invocation
2005-01-03 20:44 [Bug c++/19243] New: Misleading error message for ill-formed explicit destructor invocation austern at apple dot com
` (4 preceding siblings ...)
2005-01-05 5:21 ` austern at apple dot com
@ 2005-05-31 17:11 ` pinskia at gcc dot gnu dot org
2005-06-19 14:27 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-31 17:11 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet|all |
GCC host triplet|all |
GCC target triplet|all |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19243
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/19243] Misleading error message for ill-formed explicit destructor invocation
2005-01-03 20:44 [Bug c++/19243] New: Misleading error message for ill-formed explicit destructor invocation austern at apple dot com
` (5 preceding siblings ...)
2005-05-31 17:11 ` pinskia at gcc dot gnu dot org
@ 2005-06-19 14:27 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-19 14:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-19 14:27 -------
*** This bug has been marked as a duplicate of 12333 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19243
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-06-19 14:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-03 20:44 [Bug c++/19243] New: Misleading error message for ill-formed explicit destructor invocation austern at apple dot com
2005-01-03 20:49 ` [Bug c++/19243] " pinskia at gcc dot gnu dot org
2005-01-03 20:52 ` pinskia at gcc dot gnu dot org
2005-01-03 20:55 ` austern at apple dot com
2005-01-03 21:58 ` giovannibajo at libero dot it
2005-01-05 5:21 ` austern at apple dot com
2005-05-31 17:11 ` pinskia at gcc dot gnu dot org
2005-06-19 14:27 ` pinskia at gcc dot gnu dot org
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).