Thread overview
with (pointer to struct)
Apr 11, 2005
Thomas Kuehne
April 09, 2005
I think this is a bug:

//------------------------
struct foo {}

void main()
{
    foo f1;
    foo *f2;
    with (f1) {}   // works
    with (*f2) {}  // works
    with (f2) {}   // doesn't work
}
//------------------------

dmd test.d
test.d(9): with expressions must be class objects, not 'foo *'

DMD 0.120, Windows. Haven't tried linux.

-- 
Carlos Santander Bernal

JP2, you'll always live in our minds
April 11, 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Carlos Santander B. schrieb am Sat, 09 Apr 2005 10:47:49 -0500:
> I think this is a bug:
>
> //------------------------
> struct foo {}
>
> void main()
> {
>      foo f1;
>      foo *f2;
>      with (f1) {}   // [A] works
>      with (*f2) {}  // [B] works
>      with (f2) {}   // [C] doesn't work
> }
> //------------------------
>
> dmd test.d
> test.d(9): with expressions must be class objects, not 'foo *'

In A and B you pass a struct, in C you pass a pointer to a struct. The error message about "class objects" is missleading.

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFCWfRI3w+/yD4P9tIRAnglAJ9XTwlvmLfORmNWAP1SvVvGL6Ol4ACfa15p
bFihVej0BDoni+piwhKgvtM=
=tNlX
-----END PGP SIGNATURE-----
April 12, 2005
Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Carlos Santander B. schrieb am Sat, 09 Apr 2005 10:47:49 -0500:
> 
>>I think this is a bug:
>>
>>//------------------------
>>struct foo {}
>>
>>void main()
>>{
>>     foo f1;
>>     foo *f2;
>>     with (f1) {}   // [A] works
>>     with (*f2) {}  // [B] works
>>     with (f2) {}   // [C] doesn't work
>>}
>>//------------------------
>>
>>dmd test.d
>>test.d(9): with expressions must be class objects, not 'foo *'
> 
> 
> In A and B you pass a struct, in C you pass a pointer to a struct.
> The error message about "class objects" is missleading.
> 

I know that, but I still expect C to work.

> Thomas
> 
> 
> -----BEGIN PGP SIGNATURE-----
> 
> iD8DBQFCWfRI3w+/yD4P9tIRAnglAJ9XTwlvmLfORmNWAP1SvVvGL6Ol4ACfa15p
> bFihVej0BDoni+piwhKgvtM=
> =tNlX
> -----END PGP SIGNATURE-----


-- 
Carlos Santander Bernal

JP2, you'll always live in our minds