Thread overview
[Issue 1782] New: Instantiating nested template with wrong instantiated parent template causes ICE
Jan 12, 2008
d-bugmail
Jan 12, 2008
d-bugmail
May 13, 2009
Don
May 15, 2009
Don
January 12, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1782

           Summary: Instantiating nested template with wrong instantiated
                    parent template causes ICE
           Product: D
           Version: 1.025
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: ary@esperanto.org.ar


When compiling the following code:

---
template Foo(alias T) {
        template Temp() {
                const char[] Temp = "int x;";
        }
}

mixin(Foo!(1).Temp!());
---

DMD says:
one.d(7): template instance Foo!(1) does not match any template declaration

and then comes the ICE.


-- 

January 12, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1782





------- Comment #1 from ary@esperanto.org.ar  2008-01-11 19:10 -------
I think the bug is in expression.c, line 5152:

---
error("template identifier %s is not a member of %s %s", id->toChars(),
s->kind(), s->ident->toChars());
---

In this case, s is an instance of TemplateInstance, and so s->ident is null. It should be replaced by:

---
Identifier* id;
if (s->isTemplateInstance()) {
  id = s->isTemplateInstance()->name;
} else {
  id = s->ident;
}
error("template identifier %s is not a member of %s %s", id->toChars(),
s->kind(), id->toChars());
---

Or something similar to that.


-- 

May 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1782


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au




--- Comment #2 from Don <clugdbug@yahoo.com.au>  2009-05-13 12:52:14 PDT ---
Fixed DMD1.045. (was fixed in D2.027 or earlier)

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


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




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