Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue 7178 - Segfault with import of invalid template

  • Loading branch information...
commit 6be191a149cbfc66c720846d542559e46c0c895f 1 parent d1b420d
Walter Bright authored January 28, 2012

Showing 1 changed file with 9 additions and 2 deletions. Show diff stats Hide diff stats

  1. 11  src/template.c
11  src/template.c
... ...
@@ -1,6 +1,6 @@
1 1
 
2 2
 // Compiler implementation of the D programming language
3  
-// Copyright (c) 1999-2011 by Digital Mars
  3
+// Copyright (c) 1999-2012 by Digital Mars
4 4
 // All Rights Reserved
5 5
 // written by Walter Bright
6 6
 // http://www.digitalmars.com
@@ -3462,6 +3462,11 @@ void TemplateInstance::semantic(Scope *sc)
3462 3462
          * (if we havetempdecl, then tiargs is already evaluated)
3463 3463
          */
3464 3464
         semanticTiargs(sc);
  3465
+        if (arrayObjectIsError(tiargs))
  3466
+        {   inst = this;
  3467
+            //printf("error return %p, %d\n", tempdecl, global.errors);
  3468
+            return;             // error recovery
  3469
+        }
3465 3470
 
3466 3471
         tempdecl = findTemplateDeclaration(sc);
3467 3472
         if (tempdecl)
@@ -4350,6 +4355,8 @@ Identifier *TemplateInstance::genIdent()
4350 4355
             {   ea->error("tuple is not a valid template value argument");
4351 4356
                 continue;
4352 4357
             }
  4358
+            if (ea->op == TOKerror)
  4359
+                continue;
4353 4360
 #if 1
4354 4361
             /* Use deco that matches what it would be for a function parameter
4355 4362
              */
@@ -4887,7 +4894,7 @@ void TemplateMixin::semantic(Scope *sc)
4887 4894
 
4888 4895
     // Run semantic on each argument, place results in tiargs[]
4889 4896
     semanticTiargs(sc);
4890  
-    if (errors)
  4897
+    if (errors || arrayObjectIsError(tiargs))
4891 4898
         return;
4892 4899
 
4893 4900
     tempdecl = findBestMatch(sc);

0 notes on commit 6be191a

Please sign in to comment.
Something went wrong with that request. Please try again.