Summary: core.time.TickDuration opCmp accepts only lvalues
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime

--- Comment #0 from Matej Nanut <> 2012-02-28 13:11:53 PST 
Code snippet:

  import core.time:    TickDuration;
  import std.datetime: StopWatch, AutoStart;

  void main()
     auto wait  = TickDuration.from!`msecs`(1000);
     auto timer = StopWatch(AutoStart.yes);

     while (timer.peek < wait) // Okay.
     { }

     while (wait >= timer.peek) // Compile error.
     { }

Compiler output:

  comparison.d(13): Error: function core.time.TickDuration.opCmp (ref
const(TickDuration) rhs) const is not callable using argument types
  comparison.d(13): Error: timer.peek() is not an lvalue

I assume the same thing happens elsewhere in the library. As D strives to be an
intuitive language, I reason this to be a bug. "<" and ">=" should work
identically in this circumstance.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to