From 4b8c991870a03d6e526610cd20da75d2c96b910f Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 8 Apr 2018 06:21:33 +0000 Subject: [Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases. Summary: Currently clang doesn't do qualified lookup when building indirect field decl references. This causes ambiguity when the field is in a base class to which there are multiple valid paths even though a qualified name is used. For example: ``` class B { protected: int i; union { int j; }; }; class X : public B { }; class Y : public B { }; class Z : public X, public Y { int a() { return X::i; } // works int b() { return X::j; } // fails }; ``` Reviewers: rsmith, aaron.ballman, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45411 llvm-svn: 329521 --- clang/lib/Sema/SemaExprMember.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaExprMember.cpp') diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index c737d7bfd44..680ca99d660 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -848,7 +848,7 @@ Sema::BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS, // Build the first member access in the chain with full information. result = BuildFieldReferenceExpr(result, baseObjectIsPointer, SourceLocation(), - EmptySS, field, foundDecl, memberNameInfo) + SS, field, foundDecl, memberNameInfo) .get(); if (!result) return ExprError(); -- cgit v1.2.3