On 6 September 2012 11:58, Artur Skawina <[email protected]> wrote: > On 09/06/12 12:29, Artur Skawina wrote: >> class C { int i; auto f() { return i; } } >> int main() { >> C c; >> return c.f(); >> } >> >> Here you won't even get an assert error, just a segfault. But the >> pointer-to-class > > Argh. The reason you won't get get an assert is because I forgot to add > 'final' when converting the struct example... > > class C { int i; final f() { return i; } } > int main() { > C c; > return c.f(); > } > > > BTW, why doesn't GDC figure this out by itself? IIRC GCC gets these > cases right both for C++ and C (!), but does not devirtualize D methods, > not even in LTO/WPR mode... > > artur
All methods are virtual by default in D. If you feel there is something that can be improved in GDC's codegen, please send a testcase and a written example of the behaviour it should show, and I will look into it. :-) Regards -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
