public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53613] New: Cannot override a inline "= default" virtual destructor.
@ 2012-06-08 11:12 kirbyzhou@sogou-inc.com
  2012-06-08 11:17 ` [Bug c++/53613] " redi at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: kirbyzhou@sogou-inc.com @ 2012-06-08 11:12 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53613
           Summary: Cannot override a inline "= default" virtual
                    destructor.
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kirbyzhou@sogou-inc.com


[root@djt-17-109-v06 tmp]# cat tover.cpp 
struct __cook {
        virtual ~__cook() = default;
};

struct __cook1: public __cook {
        virtual ~__cook1() = default;
};

struct __cook2: public __cook {
        virtual ~__cook2();
};
__cook2::~__cook2() {};

struct __cook3: public __cook {
        virtual ~__cook3();
};
__cook3::~__cook3() = default;

[root@djt-17-109-v06 tmp]# g++47 -c -std=gnu++11 tover.cpp 
tover.cpp:6:10: error: looser throw specifier for 'virtual __cook1::~__cook1()'
tover.cpp:2:10: error:   overriding 'virtual __cook::~__cook() noexcept (true)'
tover.cpp:10:10: error: looser throw specifier for 'virtual
__cook2::~__cook2()'
tover.cpp:2:10: error:   overriding 'virtual __cook::~__cook() noexcept (true)'
tover.cpp:15:10: error: looser throw specifier for 'virtual
__cook3::~__cook3()'
tover.cpp:2:10: error:   overriding 'virtual __cook::~__cook() noexcept (true)
'
[root@djt-17-109-v06 tmp]# g++ -c -std=gnu++0x tover.cpp 
# g++ 4.4.6 works

Workaround: define parent destructor outside the class definition.

[root@djt-17-109-v06 tmp]# cat tover.cpp 
struct __cook {
                virtual ~__cook();
};
__cook::~__cook() = default;
/*...*/


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

* [Bug c++/53613] Cannot override a inline "= default" virtual destructor.
  2012-06-08 11:12 [Bug c++/53613] New: Cannot override a inline "= default" virtual destructor kirbyzhou@sogou-inc.com
@ 2012-06-08 11:17 ` redi at gcc dot gnu.org
  2012-06-08 11:19 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-06-08 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-08 11:16:47 UTC ---
Fixed on trunk by patch for PR 50043


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

* [Bug c++/53613] Cannot override a inline "= default" virtual destructor.
  2012-06-08 11:12 [Bug c++/53613] New: Cannot override a inline "= default" virtual destructor kirbyzhou@sogou-inc.com
  2012-06-08 11:17 ` [Bug c++/53613] " redi at gcc dot gnu.org
@ 2012-06-08 11:19 ` redi at gcc dot gnu.org
  2012-06-11 10:16 ` kirbyzhou@sogou-inc.com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-06-08 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-08 11:18:47 UTC ---
(In reply to comment #0)
> Workaround: define parent destructor outside the class definition.

Or add explicit 'noexcept' specifiers to the derived destructors.


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

* [Bug c++/53613] Cannot override a inline "= default" virtual destructor.
  2012-06-08 11:12 [Bug c++/53613] New: Cannot override a inline "= default" virtual destructor kirbyzhou@sogou-inc.com
  2012-06-08 11:17 ` [Bug c++/53613] " redi at gcc dot gnu.org
  2012-06-08 11:19 ` redi at gcc dot gnu.org
@ 2012-06-11 10:16 ` kirbyzhou@sogou-inc.com
  2012-06-11 10:29 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kirbyzhou@sogou-inc.com @ 2012-06-11 10:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Kirby Zhou <kirbyzhou@sogou-inc.com> 2012-06-11 10:15:58 UTC ---
(In reply to comment #1)
> Fixed on trunk by patch for PR 50043

Did this patch apply to 4.7 branch?
I retested with 4.7 branch 20120610, The bug is still exist.


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

* [Bug c++/53613] Cannot override a inline "= default" virtual destructor.
  2012-06-08 11:12 [Bug c++/53613] New: Cannot override a inline "= default" virtual destructor kirbyzhou@sogou-inc.com
                   ` (2 preceding siblings ...)
  2012-06-11 10:16 ` kirbyzhou@sogou-inc.com
@ 2012-06-11 10:29 ` redi at gcc dot gnu.org
  2012-06-12  2:39 ` kirbyzhou@sogou-inc.com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-06-11 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-11 10:28:40 UTC ---
(In reply to comment #3)
> (In reply to comment #1)
> > Fixed on trunk by patch for PR 50043
> 
> Did this patch apply to 4.7 branch?

PR 50043 shows a single commit to trunk and has Target Milestone 4.8.0, so no,
it's only fixed on trunk.

> I retested with 4.7 branch 20120610, The bug is still exist.

Yes, and it probably won't be fixed on the release branch as it's not a
regression.  New features are not usually added to released versions.

In any case, there's a simple workaround of adding explicit 'noexcept'
specifiers, which will still work with 4.8

I'm marking this as a dup of PR 50043 as the failure to compile is a direct
consequence of not implementing DR 1123

*** This bug has been marked as a duplicate of bug 50043 ***


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

* [Bug c++/53613] Cannot override a inline "= default" virtual destructor.
  2012-06-08 11:12 [Bug c++/53613] New: Cannot override a inline "= default" virtual destructor kirbyzhou@sogou-inc.com
                   ` (3 preceding siblings ...)
  2012-06-11 10:29 ` redi at gcc dot gnu.org
@ 2012-06-12  2:39 ` kirbyzhou@sogou-inc.com
  2012-06-12  6:28 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kirbyzhou@sogou-inc.com @ 2012-06-12  2:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Kirby Zhou <kirbyzhou@sogou-inc.com> 2012-06-12 02:39:44 UTC ---
It is a BAD NEWS about no fix on the 4.7.X branch, and "it's not a regression."

The bug breaks a lot of already exist oode which is workable with GCC-4.4.X
release. 

(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #1)
> > > Fixed on trunk by patch for PR 50043
> > 
> > Did this patch apply to 4.7 branch?
> PR 50043 shows a single commit to trunk and has Target Milestone 4.8.0, so no,
> it's only fixed on trunk.
> > I retested with 4.7 branch 20120610, The bug is still exist.
> Yes, and it probably won't be fixed on the release branch as it's not a
> regression.  New features are not usually added to released versions.
> In any case, there's a simple workaround of adding explicit 'noexcept'
> specifiers, which will still work with 4.8
> I'm marking this as a dup of PR 50043 as the failure to compile is a direct
> consequence of not implementing DR 1123
> *** This bug has been marked as a duplicate of bug 50043 ***


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

* [Bug c++/53613] Cannot override a inline "= default" virtual destructor.
  2012-06-08 11:12 [Bug c++/53613] New: Cannot override a inline "= default" virtual destructor kirbyzhou@sogou-inc.com
                   ` (4 preceding siblings ...)
  2012-06-12  2:39 ` kirbyzhou@sogou-inc.com
@ 2012-06-12  6:28 ` redi at gcc dot gnu.org
  2012-06-12  7:24 ` jakub at gcc dot gnu.org
  2012-06-12 10:48 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-06-12  6:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-12 06:27:42 UTC ---
As I said, there's a simple workaround.


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

* [Bug c++/53613] Cannot override a inline "= default" virtual destructor.
  2012-06-08 11:12 [Bug c++/53613] New: Cannot override a inline "= default" virtual destructor kirbyzhou@sogou-inc.com
                   ` (5 preceding siblings ...)
  2012-06-12  6:28 ` redi at gcc dot gnu.org
@ 2012-06-12  7:24 ` jakub at gcc dot gnu.org
  2012-06-12 10:48 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-06-12  7:24 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-06-12 07:24:07 UTC ---
As the testcase compiles with 4.4.x and trunk, but doesn't in 4.6.x and 4.7.x,
I'd call this a 4.6/4.7 Regression (unless what 4.4.x compiled it into was
completely broken).  The question is if the patch is safely backportable
though.


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

* [Bug c++/53613] Cannot override a inline "= default" virtual destructor.
  2012-06-08 11:12 [Bug c++/53613] New: Cannot override a inline "= default" virtual destructor kirbyzhou@sogou-inc.com
                   ` (6 preceding siblings ...)
  2012-06-12  7:24 ` jakub at gcc dot gnu.org
@ 2012-06-12 10:48 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-06-12 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-12 10:47:58 UTC ---
I think it compiles with 4.4 because __cook::~__cook is not noexcept, because
4.4 doesn't infer an empty throw spec for a trivial destructor.

If you add throw() to ~__cook you get the same errors about looser throw
specifiers.  So 4.4 was generating different code, but in this example it makes
no practical difference because you can't use the noexcept operator in 4.4 to
test whether something has an empty exception specifier anyway.


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

end of thread, other threads:[~2012-06-12 10:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-08 11:12 [Bug c++/53613] New: Cannot override a inline "= default" virtual destructor kirbyzhou@sogou-inc.com
2012-06-08 11:17 ` [Bug c++/53613] " redi at gcc dot gnu.org
2012-06-08 11:19 ` redi at gcc dot gnu.org
2012-06-11 10:16 ` kirbyzhou@sogou-inc.com
2012-06-11 10:29 ` redi at gcc dot gnu.org
2012-06-12  2:39 ` kirbyzhou@sogou-inc.com
2012-06-12  6:28 ` redi at gcc dot gnu.org
2012-06-12  7:24 ` jakub at gcc dot gnu.org
2012-06-12 10:48 ` redi at gcc dot gnu.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).