Thread overview
[Issue 908] New: compiler dies trying to inline static method call to nonstatic method in template code.
Jan 31, 2007
d-bugmail
Feb 12, 2007
d-bugmail
Feb 15, 2007
d-bugmail
January 31, 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@digitalmars.com
        ReportedBy: kevinbealer@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;
}


-- 

February 12, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=908


bugzilla@digitalmars.com changed:

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




------- Comment #1 from bugzilla@digitalmars.com  2007-02-12 03:45 -------
Fixed DMD 1.005


-- 

February 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=908





------- Comment #2 from thomas-dloop@kuehne.cn  2007-02-15 03:43 -------
Added to DStress as http://dstress.kuehne.cn/nocompile/i/inline_18_A.d http://dstress.kuehne.cn/nocompile/i/inline_18_B.d


--