It's as simple as not finding a definition of S. I think it's pretty obvious.<div><br><div class="gmail_quote">On Tue, May 15, 2012 at 1:18 PM, Jens Mueller <span dir="ltr"><<a href="mailto:jens.k.mueller@gmx.de" target="_blank">jens.k.mueller@gmx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">Timon Gehr wrote:<br>
> On 05/15/2012 07:44 AM, Ali Ã‡ehreli wrote:<br>
> >On 05/14/2012 10:02 PM, Timon Gehr wrote:<br>
> > > On 05/15/2012 04:28 AM, John Belmonte wrote:<br>
> > >> C API's often use a opaque struct pointer as a handle. Mapping such a<br>
> > >> struct to D using a forward declaration, I noticed that UFCS doesn't<br>
> > >> work:<br>
> > >><br>
> > >> struct State;<br>
> > >> ...<br>
> > >> State* s = new_state();<br>
> > >> foo(s); // ok<br>
> > >> s.foo(); // compile error<br>
> > >><br>
> > >> Error detail:<br>
> > >><br>
> > >> Error: struct State is forward referenced when looking for 'foo'<br>
> > >> Error: struct State is forward referenced when looking for 'opDot'<br>
> > >> Error: struct State is forward referenced when looking for 'opDispatch'<br>
> > >><br>
> > >> I'm wondering if anything would be harmed by removing this restriction.<br>
> > >><br>
> > >> As a workaround I can use "struct State {}", but that feels wrong.<br>
> > >><br>
> > ><br>
> > > This is a compiler bug. You can report it here:<br>
> > > <a href="http://d.puremagic.com/issues/" target="_blank">http://d.puremagic.com/issues/</a><br>
> ><br>
> >I would expect the compiler to need to see the definition of S to know<br>
> >that it really does not have a matching foo() member function.<br>
> ><br>
> >Ali<br>
> ><br>
><br>
> S is opaque. It does not have any visible member functions.<br>
<br>
</div></div>How should the compiler infer that S is opaque? How does it know when<br>
you write "struct State;" that State has no members? Is opaqueness<br>
implied when I do a forward declaration?<br>
<span class="HOEnZb"><font color="#888888"><br>
Jens<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br>
</div>