www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - typedef-ed class field

reply Mizuno Hiroki <hiroki1124 hotmail.com> writes:
I cannot access typedef-ed class field.

-------------------------------------------------
class Foo{
  int i;
}
typedef Foo Bar;

void main(){
  Bar bar = new Bar;
  int n = bar.i; // this for i needs to be type
                 // Foo not type Bar
}
-------------------------------------------------

--
Mizuno Hiroki
May 16 2005
next sibling parent reply David Medlock <noone nowhere.com> writes:
Mizuno Hiroki wrote:
 I cannot access typedef-ed class field.
 
 -------------------------------------------------
 class Foo{
   int i;
 }
 typedef Foo Bar;
 
 void main(){
   Bar bar = new Bar;
   int n = bar.i; // this for i needs to be type
                  // Foo not type Bar
 }
 -------------------------------------------------
 
 --
 Mizuno Hiroki

Use alias Foo Bar; -DavidM
May 16 2005
parent Mizuno Hiroki <hiroki1124 hotmail.com> writes:
David Medlock wrote:
 Mizuno Hiroki wrote:
 
I cannot access typedef-ed class field.

-------------------------------------------------
class Foo{
  int i;
}
typedef Foo Bar;

void main(){
  Bar bar = new Bar;
  int n = bar.i; // this for i needs to be type
                 // Foo not type Bar
}
-------------------------------------------------

--
Mizuno Hiroki

Use alias Foo Bar; -DavidM

------------------------------------------------- class Foo{ ... } typedef Foo Bar1; typedef Foo Bar2; void f(Bar1 bar){...} void f(Bar2 bar){...} ------------------------------------------------- -- Mizuno Hiroki
May 16 2005
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mizuno Hiroki schrieb am Mon, 16 May 2005 23:50:46 +0900:
 I cannot access typedef-ed class field.

 -------------------------------------------------
 class Foo{
   int i;
 }
 typedef Foo Bar;

 void main(){
   Bar bar = new Bar;
   int n = bar.i; // this for i needs to be type
                  // Foo not type Bar
 }
 -------------------------------------------------

Added to DStress as http://dstress.kuehne.cn/run/t/typedef_06_A.d http://dstress.kuehne.cn/run/t/typedef_06_B.d http://dstress.kuehne.cn/run/t/typedef_06_C.d http://dstress.kuehne.cn/run/t/typedef_07_A.d http://dstress.kuehne.cn/run/t/typedef_07_B.d http://dstress.kuehne.cn/run/t/typedef_07_C.d http://dstress.kuehne.cn/run/t/typedef_08_A.d http://dstress.kuehne.cn/run/t/typedef_08_B.d http://dstress.kuehne.cn/run/t/typedef_08_C.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCiipR3w+/yD4P9tIRApyQAJ9eRN/plePRvFYJkeWhd2nPGE4f1wCgzqlK Wqpu8M9NCZovmrXPHLcew2M= =iYXR -----END PGP SIGNATURE-----
May 17 2005