pointers, functions, and uniform call syntax
Iain Buclaw
ibuclaw at ubuntu.com
Thu Sep 6 09:21:32 PDT 2012
On 6 September 2012 11:58, Artur Skawina <art.08.09 at gmail.com> 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';
More information about the Digitalmars-d
mailing list