summaryrefslogtreecommitdiffstats
path: root/gcc/cp/typeck.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r--gcc/cp/typeck.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 769702b8a1d..9285ec01686 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1987,7 +1987,8 @@ build_class_member_access_expr (tree object, tree member,
OBJECT so that it refers to the class containing the
anonymous union. Generate a reference to the anonymous union
itself, and recur to find MEMBER. */
- if (ANON_AGGR_TYPE_P (DECL_CONTEXT (member)))
+ if (ANON_AGGR_TYPE_P (DECL_CONTEXT (member))
+ && !same_type_p (object_type, DECL_CONTEXT (member)))
{
tree anonymous_union;
OpenPOWER on IntegriCloud