www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 420] New: mixin make dmd break

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

           Summary: mixin make dmd break
           Product: D
           Version: 0.169
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidl 126.com


import std .stdio ;

template MGettor (alias Fld) {
  typeof(Fld) opCall () {
    writefln("getter");
    return Fld;
  }
}

class Foo {
  int a = 1 ,
      b = 2 ;

  mixin MGettor!(a) geta;
  mixin MGettor!(b) getb;
}

void main () {
  auto foo = new Foo;

  writefln(foo.geta);
  writefln(foo.getb);
}


error from dmd:
parse     a
semantic  a
semantic2 a
semantic3 a
code      a
generating code for function 'opCall'
generating code for function 'opCall'
generating code for function 'main'
foo dotexp mixin MGettor!(a);

Internal error: e2ir.c 772


-- 
Oct 09 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=420





------- Comment #1 from braddr puremagic.com  2006-10-16 03:02 -------
This is the same internal error as bug 354 which also deals with template usage
so it might be a dup.  The code samples are similar, though definitly not the
same.

I reduced the test case a bit:

import std.stdio;

template MGettor () {
  void opCall () {}
}

class Foo {
  mixin MGettor!() geta;
}

void main () {
  Foo foo = new Foo;
  writefln(foo.geta);
}


-- 
Oct 16 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=420


bugzilla digitalmars.com changed:

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




------- Comment #2 from bugzilla digitalmars.com  2006-10-18 13:28 -------
Fixed DMD 0.170


-- 
Oct 18 2006