https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61105

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #6) 
> $ cat xx.cpp && /build/gcc-60760/gcc/xgcc -B /build/gcc-60760/gcc -S -Wall
> -Wextra -Wpedantic -o/dev/null xx.cpp
> constexpr void *operator new (__SIZE_TYPE__, void *p) noexcept { return p; }
> 
> constexpr int f ()
> {
>   int i = 0;
>   int *p = new (&i) int (1);
>   return *p;
> }
> 
> constexpr int i = f ();
> $

The trunk rejects this with:
<source>:11:21:   in 'constexpr' expansion of 'f()'
<source>:11:22: error: cast from 'void*' is not allowed
   11 | constexpr int i = f ();
      |                      ^

Reply via email to