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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=102876,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=4131
          Component|tree-optimization           |c++
   Last reconfirmed|                            |2024-02-04
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
void f();
static auto const p2 = __builtin_bit_cast(void(*)(), (&f));


Even  causes the front-end to emit a dynamic initializer for p2.

There is definitely 2 issues here, one for the above and one for the original
code.

Note bit_cast is not a const expression due to being a pointer type and that is
what causes the front-end to emit dynamic initializer.

But I wonder if the front-end could try to do it without the dynamic
initializer.

Anyways confirmed.

Note there is another bug about converting dynamic initializers to static
initializers (PR 4131 and PR 102876).

Reply via email to