[Issue 7606] New: core.time.TickDuration opCmp accepts only lvalues

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 28 13:11:57 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7606

           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
        AssignedTo: nobody at puremagic.com
        ReportedBy: matejnanut at gmail.com


--- Comment #0 from Matej Nanut <matejnanut at gmail.com> 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
(TickDuration)
  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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list