UFCS on forward reference
John Belmonte
john at neggie.net
Mon May 14 19:28:42 PDT 2012
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.
More information about the Digitalmars-d
mailing list