You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an id-expression E denotes a member M of an anonymous union ([class.union.anon]) U:
If U is a non-static data member, E refers to M as a member of the lookup context of the terminal name of E (after any transformation to a class member access expression ([class.mfct.non.static])).
[Example 1: o.x is interpreted as o.u.x, where u names the anonymous union member. — end example]
IIUC, the intent of the first bullet actually means the id-expression that would denote the member of U(conceptually designated by u.x) will be reinterpreted as o.x as if x is the member of o.
Consider this case:
structA{
union {
int a;
};
voidshow(){
int c = this->a; // #1
}
};
The id-expression a denotes the member a of the anonymous union, and the terminal name of a is a, whose lookup context is just A, as per [basic.lookup.qual.general] p2. Hence, the intent of the rule may want to say a is interpreted as the member of A.
However, the note conveys a converse meaning with the intent, I think.
The text was updated successfully, but these errors were encountered:
[expr.prim.id.general] p2 says:
IIUC, the intent of the first bullet actually means the id-expression that would denote the member of
U
(conceptually designated byu.x
) will be reinterpreted aso.x
as ifx
is the member ofo
.Consider this case:
The id-expression
a
denotes the membera
of the anonymous union, and the terminal name ofa
isa
, whose lookup context is justA
, as per [basic.lookup.qual.general] p2. Hence, the intent of the rule may want to saya
is interpreted as the member ofA
.However, the note conveys a converse meaning with the intent, I think.
The text was updated successfully, but these errors were encountered: