https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127741
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |9.5.0
Known to fail| |10.1.0, 11.1.0, 17.0
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2026-10-06
Keywords| |ice-on-valid-code
Summary|[GCC C++20] `new |[C++20] `new char[(long)
|char[(long) &a]` as the |&a]` as the initializer of
|initializer of a |a namespace-scope variable
|namespace-scope variable |ICEs in
|ICEs in |`cxx_eval_call_expression`
|`cxx_eval_call_expression` |(constexpr.cc:4578)
|(constexpr.cc:4578) |
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Yuancheng Jiang from comment #0)
> A perfectly ordinary dynamic allocation whose size is a pointer converted to
> an integer
> crashes when it initializes a namespace-scope variable in C++20 mode.
This is not "perfectly normal", the result of converting a pointer to an
integer is unspecified so this is a completely nonsense allocation of a
meaningless size.
It's well-formed code, but not "perfectly normal" or realistic.
ICE started on trunk with Jakub's r11-7740:
c++: Only reject reinterpret casts from pointers to integers for
manifestly_const_eval evaluation [PR99456]
But it also ICEs with 10.1 suggesting something on the gcc-10 branch caused the
same ICE.
N.B. bugzilla does not support markdown, so this LLM-looking wall of text
doesn't format well.