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

Trass3r <trass3r at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trass3r at gmail dot com

--- Comment #2 from Trass3r <trass3r at gmail dot com> ---
Even simpler example:

const struct A
{
    A() {}
    int a = 0;
} a;

The global ctor doesn't get eliminated while clang removes it:
https://godbolt.org/z/9bjzMbx85

        .section        .text.startup,"ax",@progbits
        .type   _GLOBAL__sub_I_example.cpp, @function
_GLOBAL__sub_I_example.cpp:
        ret

It works if you remove the member a.

Reply via email to