summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/Decl.cpp9
-rw-r--r--clang/test/SemaTemplate/instantiate-using-decl.cpp24
2 files changed, 33 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 9562879de6a..1c2ead0ee59 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1353,6 +1353,15 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD) const {
cast<UsingDecl>(OldD)->getQualifier());
}
+ if (isa<UnresolvedUsingValueDecl>(this) &&
+ isa<UnresolvedUsingValueDecl>(OldD)) {
+ ASTContext &Context = getASTContext();
+ return Context.getCanonicalNestedNameSpecifier(
+ cast<UnresolvedUsingValueDecl>(this)->getQualifier()) ==
+ Context.getCanonicalNestedNameSpecifier(
+ cast<UnresolvedUsingValueDecl>(OldD)->getQualifier());
+ }
+
// A typedef of an Objective-C class type can replace an Objective-C class
// declaration or definition, and vice versa.
if ((isa<TypedefNameDecl>(this) && isa<ObjCInterfaceDecl>(OldD)) ||
diff --git a/clang/test/SemaTemplate/instantiate-using-decl.cpp b/clang/test/SemaTemplate/instantiate-using-decl.cpp
index 1bfcb7a8650..a6a4ea0e0f6 100644
--- a/clang/test/SemaTemplate/instantiate-using-decl.cpp
+++ b/clang/test/SemaTemplate/instantiate-using-decl.cpp
@@ -80,3 +80,27 @@ namespace test3 {
b.f1();
}
}
+
+namespace PR16936 {
+ // Make sure both using decls are properly considered for
+ // overload resolution.
+ template<class> struct A {
+ void access(int);
+ };
+ template<class> struct B {
+ void access();
+ };
+ template<class CELL> struct X : public A<CELL>, public B<CELL> {
+ using A<CELL>::access;
+ using B<CELL>::access;
+
+ void f() {
+ access(0);
+ }
+ };
+
+ void f() {
+ X<int> x;
+ x.f();
+ }
+}
OpenPOWER on IntegriCloud