From 68c69931412548fa89117e9b12633f84a8e74010 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 10 Feb 2009 19:52:54 +0000 Subject: [PATCH] Fix a problem with bogus template shadowing warnings git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64230 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParseTemplate.cpp | 9 ++++++--- test/SemaTemplate/temp_param.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index d17d244535..742453046b 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -251,9 +251,12 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) { SourceLocation TemplateLoc = ConsumeToken(); TemplateParameterList TemplateParams; SourceLocation LAngleLoc, RAngleLoc; - if(!ParseTemplateParameters(Depth + 1, TemplateParams, LAngleLoc, - RAngleLoc)) { - return 0; + { + ParseScope TemplateParmScope(this, Scope::TemplateParamScope); + if(!ParseTemplateParameters(Depth + 1, TemplateParams, LAngleLoc, + RAngleLoc)) { + return 0; + } } // Generate a meaningful error if the user forgot to put class before the diff --git a/test/SemaTemplate/temp_param.cpp b/test/SemaTemplate/temp_param.cpp index 249bf9a08d..e45d45629a 100644 --- a/test/SemaTemplate/temp_param.cpp +++ b/test/SemaTemplate/temp_param.cpp @@ -39,10 +39,10 @@ template // expected-error{{template parameter missing a default argument}} class B1n; -// FIXME: spurious "shadow" warning! -//template class = Y1, -// template class> -// class B1fixme; +// Check for bogus template parameter shadow warning. +template class, + template class> + class B1noshadow; // C++ [temp.param]p10: template class B2; -- 2.40.0