[Bug c/71560] union compound literal initializes wrong union field
vries at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 22 09:47:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71560
--- Comment #3 from vries at gcc dot gnu.org ---
(In reply to Martin Sebor from comment #2)
> 99) Note that this differs from a cast expression. For example, a cast
> specifies a conversion to scalar types or void only, and the result of a
> cast expression is not an lvalue.
https://gcc.gnu.org/onlinedocs/gcc/Cast-to-Union.html :
...
A cast to union is actually a constructor, not a cast, and hence does not yield
an lvalue like normal casts.
...
This implies that normal casts yield lvalues (maybe still referring to
https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Lvalues.html ?). I suppose we
should fix this bit of doc as well.
More information about the Gcc-bugs
mailing list