dmd 1.054 and 2.038 release

Jason House jason.james.house at gmail.com
Fri Jan 1 08:11:35 PST 2010


Steven Schveighoffer wrote:

> The only thing I could get to work is this:
> 
> 
> struct S
> {
>      int x;
> }
> 
> inout(int *) getSX(inout S* s) { return &s.x;}
> 
> void main()
> {
>      S s;
>      const(S)* sp = &s;
>      int *x = getSX(&s);
>      //int *y = getSX(sp);  // uncomment this line for an error
>      const(int) *y = getSX(sp);
> }
> 
> If you uncomment the designated line, the error reads:
> 
> testinout.d(13): Error: cannot implicitly convert expression (getSX(sp))
> of type const(int*) to int*
> 
> which looks good.

The error looks misleading to me.  The error is with the input argument to 
the function, not the return type.  


More information about the Digitalmars-d-announce mailing list