summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateDeduction.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-04-29 00:35:03 +0000
committerJohn McCall <rjmccall@apple.com>2010-04-29 00:35:03 +0000
commit80e58cd3e942f821c0c78d43ce93f8ecc39e30ea (patch)
tree9ba86109427fa7501d2d137136636aa14f7b9b5e /clang/lib/Sema/SemaTemplateDeduction.cpp
parentd17020676106cd77cd35d263c5549b605dad0225 (diff)
downloadbcm5719-llvm-80e58cd3e942f821c0c78d43ce93f8ecc39e30ea.tar.gz
bcm5719-llvm-80e58cd3e942f821c0c78d43ce93f8ecc39e30ea.zip
Properly switch into the declaring scope of a template when performing
template argument deduction or (more importantly) the final substitution required by such deduction. Makes access control magically work in these cases. Fixes PR6967. llvm-svn: 102572
Diffstat (limited to 'clang/lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateDeduction.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 0a2c5ae00e0..13bfc0fdf9e 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -988,6 +988,8 @@ Sema::DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial,
if (Inst)
return TDK_InstantiationDepth;
+ ContextRAII SavedContext(*this, Partial->getDeclContext());
+
// C++ [temp.deduct.type]p2:
// [...] or if any template argument remains neither deduced nor
// explicitly specified, template argument deduction fails.
@@ -1163,6 +1165,8 @@ Sema::SubstituteExplicitTemplateArguments(
if (Inst)
return TDK_InstantiationDepth;
+ ContextRAII SavedContext(*this, FunctionTemplate->getDeclContext());
+
if (CheckTemplateArgumentList(FunctionTemplate,
SourceLocation(),
ExplicitTemplateArgs,
@@ -1311,6 +1315,8 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate,
if (Inst)
return TDK_InstantiationDepth;
+ ContextRAII SavedContext(*this, FunctionTemplate->getDeclContext());
+
// C++ [temp.deduct.type]p2:
// [...] or if any template argument remains neither deduced nor
// explicitly specified, template argument deduction fails.
OpenPOWER on IntegriCloud