]> granicus.if.org Git - clang/commitdiff
Access-check during template argument deduction from the context of the
authorJohn McCall <rjmccall@apple.com>
Thu, 29 Apr 2010 01:18:58 +0000 (01:18 +0000)
committerJohn McCall <rjmccall@apple.com>
Thu, 29 Apr 2010 01:18:58 +0000 (01:18 +0000)
template decl itself, not its context.  Testcase to follow;  fixes selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102578 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateDeduction.cpp

index 13bfc0fdf9e902d3e1af237b24e6cf246266193a..e7a12d6b703fcf00634ec78aaf5f3a30c46c9f23 100644 (file)
@@ -988,7 +988,7 @@ Sema::DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial,
   if (Inst)
     return TDK_InstantiationDepth;
 
-  ContextRAII SavedContext(*this, Partial->getDeclContext());
+  ContextRAII SavedContext(*this, Partial);
 
   // C++ [temp.deduct.type]p2:
   //   [...] or if any template argument remains neither deduced nor
@@ -1165,7 +1165,7 @@ Sema::SubstituteExplicitTemplateArguments(
   if (Inst)
     return TDK_InstantiationDepth;
 
-  ContextRAII SavedContext(*this, FunctionTemplate->getDeclContext());
+  ContextRAII SavedContext(*this, FunctionTemplate->getTemplatedDecl());
 
   if (CheckTemplateArgumentList(FunctionTemplate,
                                 SourceLocation(),
@@ -1315,7 +1315,7 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate,
   if (Inst)
     return TDK_InstantiationDepth;
 
-  ContextRAII SavedContext(*this, FunctionTemplate->getDeclContext());
+  ContextRAII SavedContext(*this, FunctionTemplate->getTemplatedDecl());
 
   // C++ [temp.deduct.type]p2:
   //   [...] or if any template argument remains neither deduced nor