www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Bug with 'in' with associative array

This code fails the assert:

 class x {}
  
 int[x[]] foo;
  
 int main() {
   x[] key = new x[1];
  
   foo[key] = 0;
   assert(key in foo);
  
   return 0;
 }
I went back and tested this snippet on 0.92, and it segfaults (every time I run it) rather than asserts. However, on my larger program (where I first found this bug), it used to only segfault sometimes. Most of the time it used to work.
Jun 23 2004