www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2309] New: Crash on a template mixing in a variadic template with an undefined template identifier

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2309

           Summary: Crash on a template mixing in a variadic template with
                    an undefined template identifier
           Product: D
           Version: 1.034
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: matti.niemenmaa+dbugzilla iki.fi


template Id(xs...) { const Id = xs[0]; }

template Foo() { mixin Id!(NONEXISTENT!()); }

alias Foo!() x;

The above gives the following before crashing DMD:

foo.d(3): template instance identifier 'NONEXISTENT' is not defined

In the following case, no error message is given before the crash, which is why
I'm marking this as major:

template Id(xs...) { const Id = xs[0]; }

template Foo() { mixin Id!(NONEXISTENT!()); }

// removing the 'int' here brings the error message back
template Bar(alias F) { const int Bar = F!(); }

alias Bar!(Foo) x;


-- 
Aug 23 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2309


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch




------- Comment #1 from clugdbug yahoo.com.au  2009-04-24 03:30 -------
Here's a patch: This one is really simple.

--------------------
Index: mangle.c
===================================================================
--- mangle.c    (revision 24)
+++ mangle.c    (working copy)
   -217,7 +217,7   
     printf("\n");
 #endif
     id = ident ? ident->toChars() : toChars();
-    if (tempdecl->parent)
+    if (tempdecl && tempdecl->parent)
     {
        char *p = tempdecl->parent->mangle();
        if (p[0] == '_' && p[1] == 'D')


-- 
Apr 24 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2309


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED




--- Comment #2 from Don <clugdbug yahoo.com.au>  2009-05-14 07:28:50 PDT ---
Fixed DMD1.045 and 2.030

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 14 2009