www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20343] New: false positive in style checker, checking casts

https://issues.dlang.org/show_bug.cgi?id=20343

          Issue ID: 20343
           Summary: false positive in style checker, checking casts
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: tools
          Assignee: nobody puremagic.com
          Reporter: bugzilla d-ecke.de

The following unittest (in std.format) was rejected by the style checker:

 safe pure unittest
{
    enum A { one, two, three }

    string t2 = format("[%10s] [%-10s]", cast(A) 10, cast(A) 10);
    assert(t2 == "[ cast(A)10] [cast(A)10 ]");
}

The problem is the cast(A)10 inside the string.

--
Oct 31 2019