www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13718] New: unary minus on number literals has lower


          Issue ID: 13718
           Summary: unary minus on number literals has lower precedence
                    than UFCS
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

This is somewhat surprising when you think of the following.
    -2.sin `-sin(2)` instead of `sin(-2)`
But OTOH it's consistent with so just explicitly explaining this in the docs
would be enough IMO.

Definitely a problem is the compiler error for this.

'(JSONValue __ctmp1507 = JSONValue;
, __ctmp1507).this(2)' is not of arithmetic type, it is a JSONValue

It should read something like 'unary minus cannot be applied to a JSONValue'.

Nov 12 2014