www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - `with' that shouldn't error

reply Manfred Nowak <svv1999 hotmail.com> writes:
<code>
void main(){
  struct Entry{
    int variable;
  }
  Entry[10] table;

  with( table[ 1]) variable=0;

  class Class{
    struct Entry{
      int variable;
    }
    Entry[10] table;
    Entry opIndex( int inx){
      return table[ inx];
    }
  }
  Class c= new Class;

  with( c[ 1]) variable= 0;
}
</code>

Should not throw "c.opIndex(1) is not an lvalue".

-manfred
Feb 03 2005
parent =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Manfred Nowak wrote:
| <code>
| void main(){
|   struct Entry{
|     int variable;
|   }
|   Entry[10] table;
|
|   with( table[ 1]) variable=0;
|
|   class Class{
|     struct Entry{
|       int variable;
|     }
|     Entry[10] table;
|     Entry opIndex( int inx){
|       return table[ inx];
|     }
|   }
|   Class c= new Class;
|
|   with( c[ 1]) variable= 0;
| }
| </code>
|
| Should not throw "c.opIndex(1) is not an lvalue".

Added to DStress as
http://dstress.kuehne.cn/run/with_12.d
http://dstress.kuehne.cn/run/with_13.d

Thomas


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCDdgL3w+/yD4P9tIRAopSAKCJWuK0qMpa65QORlnEWe/gPhM6hQCeLs24
rlQXbKdzHvTlc7+8KvT6BHE=
=7M+g
-----END PGP SIGNATURE-----
Feb 12 2005