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

--- Comment #76 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
FYI this is also on the same topic:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3296.html#US27
Question:
"Related to core issue 1027, consider:

int f() {
union U { double d; } u1, u2;
(int&)u1.d = 1;
u2 = u1;
return (int&)u2.d;
}

Does this involve undefined behavior? 3.8/4 seems to say that it's OK to
clobber u1 with an int object. Then union assignment copies the object
representation, possibly creating an int object in u2 and making the return
statement well-defined. If this is well-defined, compilers are significantly
limited in the assumptions they can make about type aliasing. On the other
hand, the variant where U has an array of unsigned char member must be
well-defined in order to support std::aligned_storage."

Proposed Resolution:
"Clarify that this testcase is undefined, but that adding an array of unsigned
char to union U would make it well-defined--if a storage location is allocated
with a particular type, it should be undefined to create an object in that
storage if it would be undefined to access the stored value of the object
through the allocated type."

Disposition:
"REJECTED

Resolving this question was not deemed essential for this revision of the
Standard, but core issues 1116 remains open for possible consideration in a
future revision."

Does this mean that the boost code is still invalid because there
is no array of unsigned char ?

Or does it not count because it was REJECTED ?

Reply via email to