digitalmars.D.bugs - DMD 0.130: Properties don't access opIndexAssign overload
- Burton Radons (19/19) Sep 07 2005 This code fails compilation with the error message "p.property()[4]" is ...
- zwang (3/25) Sep 07 2005 This is an old bug. The workaround I used is to write parentheses
- =?ISO-8859-1?Q?Thomas_K=FChne?= (18/38) Sep 09 2005 -----BEGIN PGP SIGNED MESSAGE-----
This code fails compilation with the error message "p.property()[4]" is not
an lvalue.  It is valid code.
        struct Array
        {
                int opIndex (int a) { return a; }
                int opIndexAssign (int a, int b) { return a; }
        }
        
        struct Property
        {
                Array property () { Array a; return a; }
        }
        
        void test ()
        {
                Property p;
        
                p.property [4] = 8;
        }
 Sep 07 2005
Burton Radons wrote:
 This code fails compilation with the error message "p.property()[4]" is not
 an lvalue.  It is valid code.
 
         struct Array
         {
                 int opIndex (int a) { return a; }
                 int opIndexAssign (int a, int b) { return a; }
         }
         
         struct Property
         {
                 Array property () { Array a; return a; }
         }
         
         void test ()
         {
                 Property p;
         
                 p.property [4] = 8;
         }
 
 
This is an old bug. The workaround I used is to write parentheses 
explicitly like p.property()[4] = 8;
 Sep 07 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Burton Radons schrieb:
 This code fails compilation with the error message "p.property()[4]" is not
 an lvalue.  It is valid code.
 
         struct Array
         {
                 int opIndex (int a) { return a; }
                 int opIndexAssign (int a, int b) { return a; }
         }
         
         struct Property
         {
                 Array property () { Array a; return a; }
         }
         
         void test ()
         {
                 Property p;
         
                 p.property [4] = 8;
         }
Added to DStress as
http://dstress.kuehne.cn/run/o/opIndexAssign_02_A.d
http://dstress.kuehne.cn/run/o/opIndexAssign_02_B.d
http://dstress.kuehne.cn/run/o/opIndexAssign_02_C.d
http://dstress.kuehne.cn/run/o/opIndexAssign_02_D.d
http://dstress.kuehne.cn/run/o/opIndexAssign_02_E.d
http://dstress.kuehne.cn/run/o/opIndexAssign_02_F.d
http://dstress.kuehne.cn/run/o/opIndexAssign_02_G.d
http://dstress.kuehne.cn/run/o/opIndexAssign_02_H.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFDIneC3w+/yD4P9tIRAqeSAJwLjDII5nhWmJh7dtp0h9LyNq8q2gCff4My
MdwGRULXFqS/o1zVaEu9hk8=
=I8JO
-----END PGP SIGNATURE-----
 Sep 09 2005








 
  
  
 
 zwang <nehzgnaw gmail.com>
 zwang <nehzgnaw gmail.com> 