November 06, 2003
I'm having a problem when casting an object from an opIndex
and using the resulting object as an argument to the delegate in
an opApply function.

The attached example gives the following error message:

C:\projects\code\foo>dmd foreach.d
foreach.d(25): 'cast(foobar )(this.opIndex(i))' is not an lvalue

Is this a symptom for the
"
Note: Array index overloading currently does not work for the lvalue of an
op=, ++, or -- operator.
"
comment in the docs? Everything else I've tried seems to have
worked.

Lars Ivar Igesund



November 06, 2003
The difficulty you're having is the parameter to dg() is an inout parameter. That means it is passed by reference. Casting creates a conversion, which then cannot be by reference, hence the message.

"Lars Ivar Igesund" <larsivi@stud.ntnu.no> wrote in message news:bodren$pm9$1@digitaldaemon.com...
> I'm having a problem when casting an object from an opIndex
> and using the resulting object as an argument to the delegate in
> an opApply function.
>
> The attached example gives the following error message:
>
> C:\projects\code\foo>dmd foreach.d
> foreach.d(25): 'cast(foobar )(this.opIndex(i))' is not an lvalue
>
> Is this a symptom for the
> "
> Note: Array index overloading currently does not work for the lvalue of an
> op=, ++, or -- operator.
> "
> comment in the docs? Everything else I've tried seems to have
> worked.
>
> Lars Ivar Igesund
>
>
>