diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 13 | ||||
| -rw-r--r-- | clang/test/SemaCXX/tag-ambig.cpp | 17 |
2 files changed, 30 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 975a9635748..d5112a2f0cc 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -6715,6 +6715,19 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // shouldn't be diagnosing. LookupName(Previous, S); + if (Previous.isAmbiguous() && TUK == TUK_Definition) { + LookupResult::Filter F = Previous.makeFilter(); + while (F.hasNext()) { + NamedDecl *ND = F.next(); + if (ND->getDeclContext()->getRedeclContext() != SearchDC) + F.erase(); + } + F.done(); + + if (Previous.isAmbiguous()) + return 0; + } + // Note: there used to be some attempt at recovery here. if (Previous.isAmbiguous()) return 0; diff --git a/clang/test/SemaCXX/tag-ambig.cpp b/clang/test/SemaCXX/tag-ambig.cpp new file mode 100644 index 00000000000..42cb9604b08 --- /dev/null +++ b/clang/test/SemaCXX/tag-ambig.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// <rdar://problem/9168556> +typedef struct Point Point; + +namespace NameSpace { + class Point; +} + +using namespace NameSpace; + +class Test +{ +public: + struct Point { }; + virtual bool testMethod (Test::Point& p) = 0; +}; |

