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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|miscompile of               |miscompile of constexpr
                   |self-referential constexpr  |array with initializers to
                   |or constinit array          |self
                   |initializer                 |

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Another testcase:
struct Elem {
    Elem* next_ = this;
};
constexpr Elem rs[1];
const void *p = rs[0].next_;

Which shows it is just an array issue; changing rs to be a non-array works that
is:

struct Elem {
    Elem* next_ = this;
};
constexpr Elem rs;
const void *p = rs.next_;

Reply via email to