UFCS on forward reference

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Wed May 16 01:13:52 PDT 2012


On Wed, May 16, 2012 at 4:59 AM, John Belmonte <john at neggie.net> wrote:

> On Tuesday, 15 May 2012 at 05:02:20 UTC, Timon Gehr wrote:
>
>> On 05/15/2012 04:28 AM, John Belmonte wrote:
>>
>>> C API's often use a opaque struct pointer as a handle. Mapping such a
>>> struct to D using a forward declaration, I noticed that UFCS doesn't
>>> work:
>>>
>>> struct State;
>>> ...
>>> State* s = new_state();
>>> foo(s); // ok
>>> s.foo(); // compile error
>>>
>>> Error detail:
>>>
>>> Error: struct State is forward referenced when looking for 'foo'
>>> Error: struct State is forward referenced when looking for 'opDot'
>>> Error: struct State is forward referenced when looking for 'opDispatch'
>>>
>>> I'm wondering if anything would be harmed by removing this restriction.
>>>
>>> As a workaround I can use "struct State {}", but that feels wrong.
>>>
>>>
>> This is a compiler bug. You can report it here:
>> http://d.puremagic.com/issues/
>>
>
> Thanks-- filed http://d.puremagic.com/issues/**show_bug.cgi?id=8104<http://d.puremagic.com/issues/show_bug.cgi?id=8104>
> .
>
>
voted up

-- 
Bye,
Gor Gyolchanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120516/07bff120/attachment.html>


More information about the Digitalmars-d mailing list