[Bug other/89106] cast-to-union documentation incorrect w.r.t. lvalueness

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 29 23:07:00 GMT 2019


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-01-29
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
It does look seem the change went a step too far in describing the feature's
similarity to compound literals.  It probably should have been limited to
removing the mention of a constructor and correcting the part about normal
casts yielding an lvalue.  I.e., it should have replaced the sentence

  A cast to union is actually a constructor, not a cast, and hence does not
yield an lvalue like normal casts. 

with one like:

  A cast to a union creates a compound literal but yields an rvalue like
standard casts do.

How does that look?

(I suspect the part about a constructor in the original text might have been a
reference to GCC's internal representation of the cast as a CONSTRUCTOR and
didn't have anything to do with C++ constructors because those do yield
lvalues.)


More information about the Gcc-bugs mailing list