Thread overview
[Issue 3238] New: Template function reference being made without the template body being generated
Aug 10, 2009
Burton Radons
May 18, 2010
Gide Nwawudu
August 10, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3238

           Summary: Template function reference being made without the
                    template body being generated
           Product: D
           Version: 2.031
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: burton-radons@shaw.ca


Given these two files (noting that the original file didn't have an error in it, it just allowed me to cut it down further), a.d:

  struct S (T)
  {
    void m ()
    {
      intentional mistake;
    }
  }

  S! (T) f (T) ()
  {
    return S! (T) ();
  }

b.d:

  import a;

  void main ()
  {
    f! (char) ().m ();
  }

Compile them separately then link them together. The link fails because b.obj has a reference to _D1a8__T1STaZ1S1mMFZv but doesn't have a COMDAT for it (not that it could compile it).

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





--- Comment #1 from Burton Radons <burton-radons@shaw.ca>  2009-08-09 22:22:42 PDT ---
It turns out that there actually was a problem with the template; oddly enough the problem was one that causes the compiler to crash, unlike the banal semantic error here. So having invalid code appears to be a prerequisite for this problem to manifest.

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


Gide Nwawudu <gide@nwawudu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Status|NEW                         |RESOLVED
                 CC|                            |gide@nwawudu.com
         Resolution|                            |WORKSFORME


--- Comment #2 from Gide Nwawudu <gide@nwawudu.com> 2010-05-17 19:00:18 PDT ---
Works in DMD v2.046.

D:\test>dmd a.d b.d
a.d(5): Error: identifier 'intentional' is not defined
a.d(5): Error: intentional is used as a type
a.d(9): Error: template instance a.S!(char) error instantiating
b.d(5):        instantiated from here: f!(char)

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