This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.
ClosedPublic

Authored by EricWF on Apr 7 2018, 8:44 PM.

Details

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
};

Diff Detail

Event Timeline

EricWF updated this revision to Diff 141522.Apr 7 2018, 9:00 PM
  • Upload with correct test.
rjmccall accepted this revision.Apr 7 2018, 9:16 PM

Well, that is a really silly bug. Fix LGTM.

This revision is now accepted and ready to land.Apr 7 2018, 9:16 PM
This revision was automatically updated to reflect the committed changes.
EricWF updated this revision to Diff 141527.Apr 7 2018, 11:23 PM

I missed a test failure. Reuploading and recommiting latest diff to keep the history.