www.digitalmars.com         C & C++   DMDScript  

D - Bug: Properties returning associative arrays

Version: DMD v0.76 Windows
Type: Compile time error

Description:
A class has a read only property that
returns a associative array.  When 
that property is accessed and the
array indexed the compiler complains
that the property is not an lvalue.

Code sample:

class Bar
{
  int[char[]] dict;
    
  int[char[]] dictionary()
  {
    return dict;
  }
}

int main(char[][] argv)
{

  Bar b;
  
  // This is ok
  if("sdf" in b.dictionary)
    printf("yes");

  // This is an error
  // err.d(24): 'b.dictionary()' is not an lvalue
  int c = b.dictionary["sdfsd"];
}
Nov 23 2003