[cfe-commits] r64230 - in /cfe/trunk: lib/Parse/ParseTemplate.cpp test/SemaTemplate/temp_param.cpp

Douglas Gregor dgregor at apple.com
Tue Feb 10 11:52:54 PST 2009


Author: dgregor
Date: Tue Feb 10 13:52:54 2009
New Revision: 64230

URL: http://llvm.org/viewvc/llvm-project?rev=64230&view=rev
Log:
Fix a problem with bogus template shadowing warnings

Modified:
    cfe/trunk/lib/Parse/ParseTemplate.cpp
    cfe/trunk/test/SemaTemplate/temp_param.cpp

Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=64230&r1=64229&r2=64230&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Tue Feb 10 13:52:54 2009
@@ -251,9 +251,12 @@
   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

Modified: cfe/trunk/test/SemaTemplate/temp_param.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/temp_param.cpp?rev=64230&r1=64229&r2=64230&view=diff

==============================================================================
--- cfe/trunk/test/SemaTemplate/temp_param.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_param.cpp Tue Feb 10 13:52:54 2009
@@ -39,10 +39,10 @@
          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; 





More information about the cfe-commits mailing list