https://issues.dlang.org/show_bug.cgi?id=12910
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: [email protected]
Reporter: [email protected]
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()
{
f().rehash();
}
---
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
---
--