![]() |
Accessing member of non-lvalue union
This seems to be fine according to rules, right? (assuming that we won't
create a trap representation) union A { int i; float d; }; union A f() { union A a = { 10 }; return a; } int main() { // note: we don't access an object and don't use lvalues! float ff = f().d; } I wonder whether this is fine. |
Re: Accessing member of non-lvalue union
"Johannes Schaub (litb)" <schaub-johannes@web.de> writes:
> This seems to be fine according to rules, right? (assuming that we won't > create a trap representation) > > union A { > int i; > float d; > }; > > union A f() { > union A a = { 10 }; > return a; > } > > int main() { > // note: we don't access an object and don't use lvalues! > float ff = f().d; > } > > I wonder whether this is fine. I can't see anything wrong with it. -- Ben. |
| All times are GMT. The time now is 12:13 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.