www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12910] New: [AA] `rehash` is incorrectly inferred as strongly


          Issue ID: 12910
           Summary: [AA] `rehash` is incorrectly inferred as strongly pure
                    for some associative arrays
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: verylonglogin.reg gmail.com

Because of Issue 12909 `rehash` is incorrectly inferred as strongly pure for an
associative array with key of non-mutable array or pointer. As a result it can
be discarded by an optimizer and also breaks compilation of this code with `-w`
("warnings as errors" ) switch:
const(int[])[int] aa;
auto f(){ return aa; } // to make r-value

void main()
main.d(6): Warning: calling object.rehash!(const(int[])[int], const(int[]),
int).rehash without side effects discards return value of type
const(int[])[int], prepend a cast(void) if intentional

Jun 13 2014