[Issue 908] New: compiler dies trying to inline static method call to nonstatic method in template code.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 30 21:50:57 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=908

           Summary: compiler dies trying to inline static method call to
                    nonstatic method in template code.
           Product: D
           Version: 1.003
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: kevinbealer at gmail.com


dmd -ofsimple -release -inline -O simple.d
dmd: inline.c:473: virtual Expression* ThisExp::doInline(InlineDoState*):
Assertion `ids->vthis' failed.
make: *** [toplvl] Aborted

I think almost all of this syntax is necessary.  The basic rule seems to be:

If you:
- Use a class from more than one place.
- Define a nonempty nonvirtual function.
- Use incorrect 'static' syntax - the line marked //OOPS here
- The //OOPS must be from a template.

(This is on Linux.)

Thanks,
Kevin

// simple.d-----

class Quux {
    uint x;

    final uint next ()
    {
        return x;
    }
}

template Foo(T) {
    void bar()
    {
        int r = Quux.next;
    }
}

int main(char[][] args)
{
    auto prng = new Quux();
    alias Foo!(int).bar baz;

    int x = prng.next;
    baz();

    return 0;
}


-- 



More information about the Digitalmars-d-bugs mailing list