[cfe-commits] r93435 - in /cfe/trunk: lib/Sema/SemaTemplateDeduction.cpp test/SemaTemplate/temp_class_spec.cpp

Douglas Gregor dgregor at apple.com
Thu Jan 14 10:13:22 PST 2010


Author: dgregor
Date: Thu Jan 14 12:13:22 2010
New Revision: 93435

URL: http://llvm.org/viewvc/llvm-project?rev=93435&view=rev
Log:
After dyn_cast'ing, it generally makes sense to check the *output* of
the dyn_cast against NULL rather than the *input*. Fixes PR6025.

Modified:
    cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
    cfe/trunk/test/SemaTemplate/temp_class_spec.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=93435&r1=93434&r2=93435&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Thu Jan 14 12:13:22 2010
@@ -2174,7 +2174,7 @@
   // FIXME: if !OnlyDeduced, we have to walk the whole subexpression to 
   // find other occurrences of template parameters.
   const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E);
-  if (!E)
+  if (!DRE)
     return;
 
   const NonTypeTemplateParmDecl *NTTP

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

==============================================================================
--- cfe/trunk/test/SemaTemplate/temp_class_spec.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_class_spec.cpp Thu Jan 14 12:13:22 2010
@@ -330,3 +330,21 @@
 template<typename T, T N> class A0<T, N, int> { }; // expected-note{{here}}
 template<typename T, T N> class A0<T, N, int>;
 template<typename T, T N> class A0<T, N, int> { }; // expected-error{{redef}}
+
+namespace PR6025 {
+  template< int N > struct A;
+
+  namespace N 
+  {
+    template< typename F > 
+    struct B;
+  }
+
+  template< typename Protect, typename Second > 
+  struct C;
+
+  template <class T>
+  struct C< T, A< N::B<T>::value > >
+  {
+  };
+}





More information about the cfe-commits mailing list