[PATCH] D16971: Fixed crash when partial specialization is missing required parameters

don hinton via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 7 11:10:57 PST 2016


hintonda created this revision.
hintonda added reviewers: doug.gregor, lvoufo.
hintonda added a subscriber: cfe-commits.

The code sets isPartialSpecialization = false instead of returning true, which will cause a crash later when the missing template parameter is referenced.

http://reviews.llvm.org/D16971

Files:
  lib/Sema/SemaTemplate.cpp

Index: lib/Sema/SemaTemplate.cpp
===================================================================
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -2542,7 +2542,7 @@
             InstantiationDependent)) {
       Diag(TemplateNameLoc, diag::err_partial_spec_fully_specialized)
           << VarTemplate->getDeclName();
-      IsPartialSpecialization = false;
+      return true;
     }
 
     if (isSameAsPrimaryTemplate(VarTemplate->getTemplateParameters(),
@@ -6286,7 +6286,7 @@
                                                      InstantiationDependent)) {
       Diag(TemplateNameLoc, diag::err_partial_spec_fully_specialized)
         << ClassTemplate->getDeclName();
-      isPartialSpecialization = false;
+      return true;
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16971.47142.patch
Type: text/x-patch
Size: 766 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160207/25817bec/attachment.bin>


More information about the cfe-commits mailing list