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

--- Comment #2 from David Stone <david at doublewise dot net> ---
That is what seems to be happening here. It looks like by-value function
parameters have all modifications rolled back before the object is destroyed.
The following code is also erroneously rejected:

```
struct S {
        int m;

        constexpr S():
                m(1)
        {
        }
        constexpr ~S() noexcept(false) {
                if (m == 1) {
                        throw;
                }
        }
};

constexpr bool test(S v) {
        v.m = 2;
        return true;
}

static_assert(test(S()));
```

See it live: https://godbolt.org/z/qMjEfo

Reply via email to