public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107512] New: Defaulted virtual destructor not considered in constexpr context
@ 2022-11-02 20:36 kacper.slominski72 at gmail dot com
2022-11-02 20:39 ` [Bug c++/107512] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: kacper.slominski72 at gmail dot com @ 2022-11-02 20:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107512
Bug ID: 107512
Summary: Defaulted virtual destructor not considered in
constexpr context
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: kacper.slominski72 at gmail dot com
Target Milestone: ---
The following code causes a compiler error on GCC 12.2 and godbolt's trunk
(compiled with "-std=c++20 -Wall -Wextra -Wpedantic"):
struct base {
constexpr virtual ~base() = default;
};
struct derived final : base {
constexpr virtual ~derived() = default;
};
constexpr derived der;
The reported error is:
<source>:9:19: error: 'virtual constexpr derived::~derived()' used before its
definition
9 | constexpr derived der;
| ^~~
Changing the destructor to the following makes the error go away:
constexpr virtual ~derived() { }
As does making the variable not constexpr. Clang seems to accept this without
any problems.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/107512] Defaulted virtual destructor not considered in constexpr context
2022-11-02 20:36 [Bug c++/107512] New: Defaulted virtual destructor not considered in constexpr context kacper.slominski72 at gmail dot com
@ 2022-11-02 20:39 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-02 20:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107512
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Duplicate of PR 93413.
*** This bug has been marked as a duplicate of bug 93413 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-02 20:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02 20:36 [Bug c++/107512] New: Defaulted virtual destructor not considered in constexpr context kacper.slominski72 at gmail dot com
2022-11-02 20:39 ` [Bug c++/107512] " pinskia 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).