diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-10-23 16:06:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-10-23 16:06:17 +0000 |
commit | 77a1a8868e03bb74412f001f32d66ce0c26afae6 (patch) | |
tree | e69129b938e94153f77bc4264fffe132fcb07379 /lib/Sema/SemaLookup.cpp | |
parent | 14bd96571ef6f0e97dc79ec4d01b547d60e8fa68 (diff) |
C++ [basic.scope.hiding] allows an ordinary name to hide a non-tag
name *in the same scope*, but not across scopes. Implement the
highlighted condition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index cc27e35bb0..67d22ee924 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -407,8 +407,13 @@ void LookupResult::resolveKind() { // But it's still an error if there are distinct tag types found, // even if they're not visible. (ref?) if (HideTags && HasTag && !Ambiguous && - (HasFunction || HasNonFunction || HasUnresolved)) - Decls[UniqueTagIndex] = Decls[--N]; + (HasFunction || HasNonFunction || HasUnresolved)) { + if (Decls[UniqueTagIndex]->getDeclContext()->getRedeclContext()->Equals( + Decls[UniqueTagIndex? 0 : N-1]->getDeclContext()->getRedeclContext())) + Decls[UniqueTagIndex] = Decls[--N]; + else + Ambiguous = true; + } Decls.set_size(N); |