www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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;
}


-- 
Jan 30 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=908


bugzilla digitalmars.com changed:

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





Fixed DMD 1.005


-- 
Feb 12 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=908






Added to DStress as
http://dstress.kuehne.cn/nocompile/i/inline_18_A.d
http://dstress.kuehne.cn/nocompile/i/inline_18_B.d


-- 
Feb 15 2007