https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61105
Theodore.Papadopoulo at inria dot fr changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |Theodore.Papadopoulo@inria.
| |fr
--- Comment #12 from Theodore.Papadopoulo at inria dot fr ---
With gcc version 14.2.1 20250110 (Red Hat 14.2.1-7) (GCC), we have:
mururoa-> g++ test1.cpp
test1.cpp:3:34: error: cast from ‘void*’ is not allowed in a constant
expression before C++26
3 | constexpr int *p = new (nullptr) int;
| ^~~
mururoa-> g++ -std=c++26 test1.cpp
test1.cpp:3:34: error: cast from ‘void*’ is not allowed in a constant
expression because ‘operator new(4, 0)’ does not point to an object
3 | constexpr int *p = new (nullptr) int;
Problem solved ?
But it seems weird to advocate for c++26, when the code is still invalid in
that case (if the c++26 flag is valid and the c++26 behavior is implemented).