Do not add using directives to a function decl context when instantiating.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163208 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 69b72c5..28e4116 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1813,7 +1813,12 @@
D->getIdentLocation(),
D->getNominatedNamespace(),
D->getCommonAncestor());
- Owner->addDecl(Inst);
+
+ // Add the using directive to its declaration context
+ // only if this is not a function or method.
+ if (!Owner->isFunctionOrMethod())
+ Owner->addDecl(Inst);
+
return Inst;
}