[Bug web/69356] New: Wrong description of compound literals for scalar types
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69356 Bug ID: 69356 Summary: Wrong description of compound literals for scalar types Product: gcc Version: unknown Status: UNCONFIRMED Severity: minor Priority: P3 Component: web Assignee: unassigned at gcc dot gnu.org Reporter: christian.brauner at mailbox dot org Target Milestone: --- In section 6.26 Compound Literals of the gcc manual it is stated that "Compound literals for scalar types and union types are also allowed, but then the compound literal is equivalent to a cast." Which is either wrong or at least misleading. A cast does not yield an lvalue whereas a compound literal for scalar types does. So either this line should go into a little more detail as to how compound literals for scalar types and unions are equivalent to casts or the subclause "but then the compound literal is equivalent to a cast" should be dropped.
[Bug web/69356] Wrong description of compound literals for scalar types
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69356 Christian Brauner changed: What|Removed |Added Keywords||documentation URL||https://gcc.gnu.org/onlined ||ocs/gcc/Compound-Literals.h ||tml --- Comment #1 from Christian Brauner --- The rationale behind this can be found in section 6.5.2.5 [Compound literals] of the C-standard (http://www.iso-9899.info/n1570.html) in Footnote 99: "Footnote 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."