[Bug c++/58102] rejects valid initialization of constexpr object with mutable member

richard-gccbugzilla at metafoo dot co.uk gcc-bugzilla@gcc.gnu.org
Tue Sep 16 01:34:00 GMT 2014


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

--- Comment #3 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> ---
Thanks, that is (was) a Clang bug; I've just fixed it. And there's a standard
defect here too, as far as I can see:

  union U { int a; mutable int b; };
  constexpr U u1 = {1};
  int k = (u1.b = 2);
  constexpr U u2 = u1;

... should be ill-formed, but as far as I can see it's not (the union
construction copies the object representation, and never looks at the fields).



More information about the Gcc-bugs mailing list