June 13, 2014
https://issues.dlang.org/show_bug.cgi?id=12909

          Issue ID: 12909
           Summary: [AA] Function is incorrectly inferred as strongly pure
                    for associative array with immutable array keys as
                    argument
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody@puremagic.com
          Reporter: verylonglogin.reg@gmail.com

This code should compile without warnings:
---
int f(immutable(int[])[int] a) pure nothrow
{
    a[0] = [];
    return 0;
}

void main()
{
    immutable(int[])[int] aa;
    aa.f();
}
---
main.d(10): Warning: calling main.f without side effects discards return value
of type int, prepend a cast(void) if intentional
---

This is a major issue as it creates release-only bugs also depending on `-inline` switch as optimizer can not call such functions if it isn't already inlined:
---
import std.stdio;

void f(immutable(string)[int] a) pure nothrow
{
    // This `try` is needed to prevent inlining if compiled
    // with `-inline`:
    try debug writeln("f called."); catch { }

    a[1] = "a";
}

void main()
{
    immutable(string)[int] aa = [0 : ""];
    aa.f();
    writeln(aa);
}
---

Writes `[0:""]` if optimized.

--