]> granicus.if.org Git - clang/commitdiff
Fix a problem with bogus template shadowing warnings
authorDouglas Gregor <dgregor@apple.com>
Tue, 10 Feb 2009 19:52:54 +0000 (19:52 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 10 Feb 2009 19:52:54 +0000 (19:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64230 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseTemplate.cpp
test/SemaTemplate/temp_param.cpp

index d17d2445351a9d866775a734c19d8947948f5ce2..742453046b380586af74b1f2e75663513dc1bc28 100644 (file)
@@ -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
index 249bf9a08d5fca078f4cc6a039e01479686377f0..e45d45629a5768fb1129a4951e9217800ce91890 100644 (file)
@@ -39,10 +39,10 @@ template<int N = 5,  // expected-note{{previous default template argument define
          int M>  // expected-error{{template parameter missing a default argument}}
   class B1n;
 
-// FIXME: spurious "shadow" warning!
-//template<template<class T> class = Y1,
-//         template<class T> class>
-//  class B1fixme;
+// Check for bogus template parameter shadow warning.
+template<template<class T> class,
+         template<class T> class>
+  class B1noshadow;
 
 // C++ [temp.param]p10:
 template<class T1, class T2 = int> class B2;