www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1782] New: Instantiating nested template with wrong instantiated parent template causes ICE

reply d-bugmail puremagic.com writes:
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.


-- 
Jan 11 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1782






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.


-- 
Jan 11 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1782


Don <clugdbug yahoo.com.au> changed:

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





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 13 2009
prev sibling parent d-bugmail puremagic.com writes:
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: -------
May 15 2009