[Bug c/69202] semicolon at end of expression statement
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jan 8 21:40:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69202
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There are two different things:
compounded literals: (type){expression}
Expression statements: ({expression;})
They both have a value associated with them. compounded literal is a lvalue
while an expression statement is rvalue.
That is:
t = (pmd_t) { val };
is like having:
pmd_t anonymous = { val } ;
t = anonymous;
t = ({expression;}) is like having:
type anonymous;
do {
expressions;
anonymous = last_expression;
}
t = (type)anonymous;
Note the cast causes the lvalue to become an rvalue.
More information about the Gcc-bugs
mailing list