diff options
author | Eric Fiselier <eric@efcs.ca> | 2018-04-08 06:21:33 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2018-04-08 06:21:33 +0000 |
commit | 4b8c991870a03d6e526610cd20da75d2c96b910f (patch) | |
tree | 594b91926f1d6c42dcdf8bf916f56949e58890af /clang/test | |
parent | 80440deed41d88ddae7edca3ae8a56b4dbccc67e (diff) | |
download | bcm5719-llvm-4b8c991870a03d6e526610cd20da75d2c96b910f.tar.gz bcm5719-llvm-4b8c991870a03d6e526610cd20da75d2c96b910f.zip |
[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
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaCXX/PR35832.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/PR35832.cpp b/clang/test/SemaCXX/PR35832.cpp new file mode 100644 index 00000000000..fd47cd6a5ee --- /dev/null +++ b/clang/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; } +}; |