I was able to reduce the code to the following, which involves std.datetime.benchmark. However, I have not investigated whether this is a compiler or Phobos bug. Hence the vague subject. :( The bug manifests itself only if the four conditions are satisfied in the reduced code (-O, -inline, etc. do not make any difference): import std.stdio; import std.datetime; alias T = real; // Must be 'real' enum testCount = 7; // Must be > 6 T foo() { // Must return a value return 42; } void main() { // Must cast to void const m = benchmark!(() => cast(void)foo)(testCount); writeln(m[0].msecs); } The output of the program (test measurement) is not 0 (or a very small number of milliseconds) as one would expect: -9223372036854775808 Ali
Hi, Ali! I was not able to compile your initial code in the bug report, so I slightly modified it to compile: ```d import std.stdio; import std.datetime.stopwatch; // this was `import std.datetime;` alias T = real; // Must be 'real' enum testCount = 7; // Must be > 6 T foo() { // Must return a value return 42; } void main() { // Must cast to void const m = benchmark!(() => cast(void)foo)(testCount); writeln(m[0].total!"msecs"); // this was `writeln(m[0].msecs);` } ``` Running this code yields `0`. I will close this as WORKSFORME, but please reopen if there is anything that I am missing.
Thanks! Works for me as well.