http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55893



--- Comment #6 from Frank Heckenbach <f.heckenb...@fh-soft.de> 2013-01-09 
04:15:35 UTC ---

(In reply to comment #5)

> Caused by http://gcc.gnu.org/PR49673 I believe.  Perhaps instead of testing

> whether TYPE_NEEDS_CONSTRUCTING we need to check if the type has non-trivial

> destructor (is a user destructor on const qualified vars allowed to store into

> the var anywhere?)



According to

http://stackoverflow.com/questions/2271046/if-changing-a-const-object-is-undefined-behavior-then-how-do-constructors-and-de

(see references in the accepted answer), it is.



So perhaps, if any user destructor exists (direct or indirect through base

classes or fields), the object cannot be stored in read-only data (unless the

compiler can prove that it's still safe). If none exists, then updating the

vtable pointer is unneeded and it can be stored in read-only data.

Reply via email to