[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.
authorEric Fiselier <eric@efcs.ca>
Sun, 8 Apr 2018 06:21:33 +0000 (06:21 +0000)
committerEric Fiselier <eric@efcs.ca>
Sun, 8 Apr 2018 06:21:33 +0000 (06:21 +0000)
commit4b8c991870a03d6e526610cd20da75d2c96b910f
tree594b91926f1d6c42dcdf8bf916f56949e58890af
parent80440deed41d88ddae7edca3ae8a56b4dbccc67e
[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
clang/lib/Sema/TreeTransform.h
clang/test/SemaCXX/PR35832.cpp [new file with mode: 0644]