aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaLookup.cpp8
-rw-r--r--test/SemaCXX/using-decl-pr4450.cpp15
2 files changed, 21 insertions, 2 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index e6f3d9ec3b..4d25f5b480 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -325,7 +325,9 @@ Sema::LookupResult::CreateLookupResult(ASTContext &Context, NamedDecl *D) {
if (ObjCCompatibleAliasDecl *Alias
= dyn_cast_or_null<ObjCCompatibleAliasDecl>(D))
D = Alias->getClassInterface();
-
+ if (UsingDecl *UD = dyn_cast_or_null<UsingDecl>(D))
+ D = UD->getTargetDecl();
+
LookupResult Result;
Result.StoredKind = (D && isa<OverloadedFunctionDecl>(D))?
OverloadedDeclSingleDecl : SingleDecl;
@@ -358,7 +360,9 @@ Sema::LookupResult::CreateLookupResult(ASTContext &Context,
if (ObjCCompatibleAliasDecl *Alias
= dyn_cast_or_null<ObjCCompatibleAliasDecl>(D))
D = Alias->getClassInterface();
-
+ if (UsingDecl *UD = dyn_cast_or_null<UsingDecl>(D))
+ D = UD->getTargetDecl();
+
Result.StoredKind = SingleDecl;
Result.First = reinterpret_cast<uintptr_t>(D);
Result.Last = 0;
diff --git a/test/SemaCXX/using-decl-pr4450.cpp b/test/SemaCXX/using-decl-pr4450.cpp
new file mode 100644
index 0000000000..c3d5b83006
--- /dev/null
+++ b/test/SemaCXX/using-decl-pr4450.cpp
@@ -0,0 +1,15 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+namespace A {
+ void g();
+}
+
+namespace X {
+ using A::g;
+}
+
+void h()
+{
+ A::g();
+ X::g();
+}