Index: lib/Sema/SemaExprMember.cpp =================================================================== --- lib/Sema/SemaExprMember.cpp +++ lib/Sema/SemaExprMember.cpp @@ -848,7 +848,7 @@ // 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(); Index: lib/Sema/TreeTransform.h =================================================================== --- lib/Sema/TreeTransform.h +++ lib/Sema/TreeTransform.h @@ -2239,7 +2239,6 @@ // We have a reference to an unnamed field. This is always the // base of an anonymous struct/union member access, i.e. the // field is always of record type. - assert(!QualifierLoc && "Can't have an unnamed field with a qualifier!"); assert(Member->getType()->isRecordType() && "unnamed member not of record type?"); Index: test/SemaCXX/PR35832.cpp =================================================================== --- /dev/null +++ test/SemaCXX/PR35832.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// expected-no-diagnostics + +class B { +public: + int i; + struct { struct { union { int j; }; }; }; + union { int k; }; +}; + +class X : public B { }; +class Y : public B { }; + +class Z : public X, public Y { +public: + int a() { return X::i; } + int b() { return X::j; } + int c() { return X::k; } + int d() { return this->X::j; } +};