www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - with (pointer to struct)

reply "Carlos Santander B." <csantander619 gmail.com> writes:
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
Apr 09 2005
parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----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-----
Apr 10 2005
parent "Carlos Santander B." <csantander619 gmail.com> writes:
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
Apr 11 2005