public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95860] New: Wrong "looser exception specification" when a class has 2 prospective destructors.
@ 2020-06-24  8:05 okannen at gmail dot com
  2023-05-08 19:53 ` [Bug c++/95860] " ppalka at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: okannen at gmail dot com @ 2020-06-24  8:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95860
           Summary: Wrong "looser exception specification" when a class
                    has 2 prospective destructors.
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: okannen at gmail dot com
  Target Milestone: ---

Tested with gcc --version:
gcc (GCC) 10.1.1 20200613
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The following code should compile:

struct A {
        virtual ~A() =default;
        };

template <bool C>
struct B 
        :A
        {
        ~ B() =default;                 //destructor 1
        ~ B() requires (C) =default;    //destructor 2

        };

int main(){
        B<true> b;
        }
The destructor of B<true> is the "destrurcor 2". Nevertheless, GCC complains
that "destructor 1" has a looser exception specification than the base
destructor:

test.cpp: In instantiation of ‘struct B<true>’:
test.cpp:144:10:   required from here
test.cpp:138:2: error: looser exception specification on overriding virtual
function ‘B<C>::~B() [with bool C = true]’
  138 |  ~ B() =default;
      |  ^
test.cpp:131:10: note: overridden function is ‘virtual constexpr A::~A()
noexcept’
  131 |  virtual ~A() =default;
      |          ^

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

* [Bug c++/95860] Wrong "looser exception specification" when a class has 2 prospective destructors.
  2020-06-24  8:05 [Bug c++/95860] New: Wrong "looser exception specification" when a class has 2 prospective destructors okannen at gmail dot com
@ 2023-05-08 19:53 ` ppalka at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-08 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
             Blocks|                            |67491

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The error message doesn't make much sense here, but is this example strictly
speaking valid given that virtual functions can't be constrained
([class.virtual]/6)?


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

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

end of thread, other threads:[~2023-05-08 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24  8:05 [Bug c++/95860] New: Wrong "looser exception specification" when a class has 2 prospective destructors okannen at gmail dot com
2023-05-08 19:53 ` [Bug c++/95860] " ppalka 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).