www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14182] New: AA with pointer key can't find key (regression)

https://issues.dlang.org/show_bug.cgi?id=14182

          Issue ID: 14182
           Summary: AA with pointer key can't find key (regression)
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: timothee.cour2 gmail.com

git head (v2.067-devel-e542e14):
dmd -run main.d passes but this is surprising.
dmd(2.066.rc2): this fails at pa !in map which seems more correct, but still
weird for lines 4 and 5 simultaneously.
void main(){
  int[int*]map;//Same below if this line changes to int[const(int)*] map;
  assert(typeof(map).stringof=="int[const(int)*]");//why?
  assert(is(typeof(map)==int[const(int)*]));//where did const came from
  assert(is(typeof(map)==int[int*]));//why both are true?

  auto pa=new int;
  map[pa]=0;
  assert(pa !in map);//REGRESSION: worked in dmd.066(rc2)
  assert((cast(const(int)*)pa) !in map);//why not either?
}

Furthermore, with int[int*]map=>int[immutable(int)*]map we have:
void main(){
  int[immutable(int)*]map;
  assert(is(typeof(map)==int[immutable(int)*]));//ok
  immutable pa=new int;
  map[pa]=0;
  assert(pa !in map);//REGRESSION: worked in dmd.066(rc2)
}

--
Feb 15 2015