https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86769
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #60376|0 |1
is obsolete| |
--- Comment #22 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 60377
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60377&action=edit
gcc15-pr86769.patch
Full so far untested patch. Note the constexpr-86769.C testcase FAILs with
clang++ and MSVC:
<source>:21:16: error: static assertion expression is not an integral constant
expression
21 | static_assert (foo () == 136);
| ^~~~~~~~~~~~~
<source>:6:28: note: allocation performed here was not deallocated
6 | constexpr A (int x) : a (new int (x)) {}
| ^
<source>:36:16: error: static assertion expression is not an integral constant
expression
36 | static_assert (bar () == 120);
| ^~~~~~~~~~~~~
<source>:6:28: note: allocation performed here was not deallocated
6 | constexpr A (int x) : a (new int (x)) {}
| ^
and
<source>(21): error C2131: expression did not evaluate to a constant
<source>(6): note: failure was caused by allocated storage not being
deallocated
<source>(36): error C2131: expression did not evaluate to a constant
<source>(6): note: failure was caused by allocated storage not being
deallocated
but that seems to me like a bug in both compilers. If I remove all the
constexpr keywords and just evaluate it outside of compile time evaluation,
then the number of A ctors and dtors is the same and everything that has been
allocated is deallocated, valgrind is happy about those too.