Bug 908 – compiler dies trying to inline static method call to nonstatic method in template code.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2007-01-30T23:50:00Z
Last change time
2014-02-16T15:22:28Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
kevinbealer
Comments
Comment #0 by kevinbealer — 2007-01-30T23:50:49Z
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;
}