Thread overview
[Issue 3261] New: compiler crash with mixin and forward reference (Issue 402 and 784)
Aug 20, 2009
ktswital@gmail.com
Aug 25, 2009
Don
Aug 25, 2009
Stewart Gordon
Oct 13, 2009
Walter Bright
August 20, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3261

           Summary: compiler crash with mixin and forward reference (Issue
                    402 and 784)
           Product: D
           Version: 2.032
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: ktswital@gmail.com


this is slightly different code from Issue 402 and Issue 784, but it causes the compiler to freeze in DMD 1.046 and 2.032:

> dmd -c Conflicts.d
Conflicts.d(12): Error: mixin Conflicts.foo.BadImpl!(uint,Mix1) cannot resolve
forward reference
Conflicts.d(12): Error: mixin Conflicts.foo.BadImpl!(uint,Mix1) cannot resolve
forward reference

--- Conflicts.d ----

template BadImpl(T, alias thename)
{
  void a_bad_idea(T t)
  {
    thename.a_bad_idea(t);
  }
}

class foo
{
  mixin BadImpl!(uint,Mix1) Mix1;
}

int main()
{
  return 0;
}

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


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

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




--- Comment #1 from Don <clugdbug@yahoo.com.au>  2009-08-25 02:30:46 PDT ---
Here's a superficial patch. If an error occurs while determining the arguments, it shouldn't try to determine which template is intended.


Patch: template.c, line 4542.
--------
    // Run semantic on each argument, place results in tiargs[]
+    int olderrors = global.errors;
    semanticTiargs(sc);
+    if (global.errors != olderrors) return; // Quit immediately if error
occurs in argument

    tempdecl = findBestMatch(sc);
    if (!tempdecl)
    {    inst = this;
    return;        // error recovery
    }

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


Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |340




--- Comment #2 from Stewart Gordon <smjg@iname.com>  2009-08-25 11:29:12 PDT ---
I guess this counts as an actual forward reference bug, given that Mix1 is kind-of a forward reference....

(This seems to be a variation of CRTP.)

(In reply to comment #0)
> this is slightly different code from Issue 402 and Issue 784, but it causes the compiler to freeze in DMD 1.046 and 2.032:

Uh, 2.032 doesn't seem to have been released yet.

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


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2009-10-13 13:46:43 PDT ---
Fixed dmd 1.049 and 2.034

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