Commit Graph

3 Commits

Author SHA1 Message Date
Eric Fiselier 4b8c991870 [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
2018-04-08 06:21:33 +00:00
Eric Fiselier 80440deed4 Revert "[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases."
This reverts commit r329519. There are some unaddressed test failures.

llvm-svn: 329520
2018-04-08 06:05:33 +00:00
Eric Fiselier 35177d0fec [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
2018-04-08 05:50:01 +00:00