title: Why cannot I cast to immutable in @safe functions? (D)
body: <p>Why cannot I cast mutable variables to immutable values in @safe functions? Also, is there a workaround for this? </p>
  
  <pre><code>@safe pure immutable(char[][char[]]) getNameValuePair {
      immutable(char[])[immutable(char[])] pair;
      // logics filling the pair here
      return cast(immutable(char[][char[]])) pair;
  }
  </code></pre>
  
  <p>This code will cause the compile error: </p>
  
  <blockquote>
    <p>Error: cast from immutable(char[])[immutable(char[])] to immutable(char[][const(char)[]]) not allowed in safe code</p>
  </blockquote>
  
  <p>When I do <code>return pair.idup</code>, I get the error: <code>no property 'idup' for type 'immutable(char[])[immutable(char[])]'</code>.</p>