CTFE question

bearophile bearophileHUGS at lycos.com
Mon Sep 3 07:08:34 PDT 2012


Philippe Sigaud:

> Worth a bug report?

Yeah. CTFE must give the same results when CTFE works.

A simpler test case for Bugzilla:

import std.stdio;
int[] foo(int[] data) {
      foreach (i, ref x; data) {
          x++;
          i++;
      }
      return data;
}
void main() {
     enum result1 = foo([10, 20, 30, 40]);
     auto result2 = foo([10, 20, 30, 40]);
     writeln(result1); // [11, 21, 31, 41]
     writeln(result2); // [11, 20, 31, 40]
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list