digitalmars.D.bugs - typedef-ed ctor
- typedef d.com (28/28) May 09 2005 Suppose a class has ctor defined, then a typedef-ed class cannot use tha...
- Thomas Kuehne (15/42) May 11 2005 -----BEGIN PGP SIGNED MESSAGE-----
Suppose a class has ctor defined, then a typedef-ed class cannot use that ctor: ------------------------------------------------------------ class A { public this(int param) {} } typedef A B; #void foo() { A(0); // OK expression ------------------------------------------------------------ by contrast, if no ctor defined in A, then it works: ------------------------------------------------------------ class A {} typedef A B; void foo() { A a = new A(); //OK B b = new B(); //OK } ------------------------------------------------------------
May 09 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 typedef d.com schrieb am Tue, 10 May 2005 02:00:09 +0000 (UTC):Suppose a class has ctor defined, then a typedef-ed class cannot use that ctor: ------------------------------------------------------------ class A { public this(int param) {} } typedef A B; #void foo() { A(0); // OK expression ------------------------------------------------------------ by contrast, if no ctor defined in A, then it works: ------------------------------------------------------------ class A {} typedef A B; void foo() { A a = new A(); //OK B b = new B(); //OK } ------------------------------------------------------------This is illegal code: http://digitalmars.com/d/class.html#constructors Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCgr903w+/yD4P9tIRAmD/AKDIMkyX2t4vBwebTvtYjGmEcfdLDACcCUxV Z58F8YAyPXK17lDQxlEtVXg= =l/k8 -----END PGP SIGNATURE-----
May 11 2005