[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.
authorEric Fiselier <eric@efcs.ca>
Sun, 8 Apr 2018 05:50:01 +0000 (05:50 +0000)
committerEric Fiselier <eric@efcs.ca>
Sun, 8 Apr 2018 05:50:01 +0000 (05:50 +0000)
commit35177d0fec5e8aed2312ef0aff5b5c9746b790b9
tree79c75d2cda791ab00eee94c59c4ff821c46b2ca5
parente099fc1806168c571a34c8fd93e3019c52469d99
[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: 329519
clang/lib/Sema/SemaExprMember.cpp
clang/test/SemaCXX/PR35832.cpp [new file with mode: 0644]