public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96614] New: constexpr deletion failure through pointer to base with virtual base class
@ 2020-08-14 9:42 pkeir at outlook dot com
2020-08-17 6:45 ` [Bug c++/96614] " marxin at gcc dot gnu.org
2021-08-17 5:56 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: pkeir at outlook dot com @ 2020-08-14 9:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96614
Bug ID: 96614
Summary: constexpr deletion failure through pointer to base
with virtual base class
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pkeir at outlook dot com
Target Milestone: ---
Created attachment 49062
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49062&action=edit
A C++ file containing the code described.
The C++20 code below (also attached) fails to compile with GCC trunk.
struct FooBase {
constexpr virtual ~FooBase() {}
};
struct Foo : public FooBase {};
constexpr bool test()
{
FooBase* pb = new Foo;
delete pb;
return true;
}
int main(int argc, char *argv[])
{
static_assert(test());
test(); // no problem
return 0;
}
The error is invoked by the `static_assert` expression, and relates to the call
to `delete pb`. It states:
virtual constexpr Foo::~Foo()’ used before its definition
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-17 5:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-14 9:42 [Bug c++/96614] New: constexpr deletion failure through pointer to base with virtual base class pkeir at outlook dot com
2020-08-17 6:45 ` [Bug c++/96614] " marxin at gcc dot gnu.org
2021-08-17 5:56 ` 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).