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

David Stone <david at doublewise dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david at doublewise dot net

--- Comment #3 from David Stone <david at doublewise dot net> ---
Here is a reproduction that does not require const_cast:


struct S {
    int a = 1;
    int * ptr = &a;
};

constexpr bool f() {
    auto const s = S{};
    *s.ptr = 2;
    return s.a == 2;
}

static_assert(f());


See it live: https://godbolt.org/z/30O7_j

Reply via email to