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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Simple as:
```
struct bar a;

bar create() noexcept
{
  bar t; // NVR will transform t into the copy passed in
  t = a;
  t.data[10]++;
  t.data[20] = a.data[10];
  return t;
}

void g()
{
  foo_not_ok(a);
}
```

If the copy is removed in foo_not_ok, then NVR would be invalid. But the C++17
standard allows (requires?) for NVR here. So not having a copy will get the
wrong value into t.data[20].

Reply via email to