www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11570] New: AssertError with opDispatch

https://d.puremagic.com/issues/show_bug.cgi?id=11570

           Summary: AssertError with opDispatch
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: stevencoenen gmail.com



Following code generates an AssertError when executed.

class forward(T)
{
  void opDispatch(string s, T2)(T2 i)
  {
    import std.stdio;
    writeln(s);
  }
}

void main()
{
  forward!(string) a;
  a.foo(1);
}

dmd forward.d
./forward

core.exception.AssertError forward.d(4): null this
----------------
./forward(_d_assert_msg+0x18) [0x807beb8]
./forward(void forward.forward!(immutable(char)[]).forward.opDispatch!("foo",
int).opDispatch(int)+0x29) [0x8073c4d]
./forward(_Dmain+0xc) [0x8073c20]
./forward(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).void runMain()+0x10) [0x807c3e0]
./forward(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).void tryExec(scope void delegate())+0x18) [0x807c080]
./forward(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).void runAll()+0x37) [0x807c427]
./forward(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).void tryExec(scope void delegate())+0x18) [0x807c080]
./forward(_d_run_main+0x121) [0x807c051]
./forward(main+0x14) [0x807bf24]
/lib32/libc.so.6(__libc_start_main+0xe7) [0xf751b597]
./forward() [0x8073b41]
----------------

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