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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-06-17
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed as a documentation bug.  The quoted sentence:

  Compound literals for scalar types and union types are also allowed, but then
the compound literal is equivalent to a cast.

is incorrect because a compound literal is an lvalue while a cast yields an
rvalue.  So for example:

  int i;
  i = ++(int){ 123.4 };

is valid and initializes i to 124, while

  i = ++(int)123;

is not valid.  This reflected in footnote 99 in C11 which clarifies the
semantics of compound literals by saying:

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.

Reply via email to