www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20526] New: Compiling a program without unit tests with

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

          Issue ID: 20526
           Summary: Compiling a program without unit tests with
                    "-unittest" prints "1 unittests passed"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: petar.p.kirov gmail.com

$ cat test.d
void main()
{
    import std.algorithm.sorting : sort;
    int[] arr1 = [5, 2, 8];
    auto s = arr1.sort;
}

$ dmd -unittest test.d && ./test
1 unittests passed

The root cause is most likely a unit test nested inside a template, which gets
instantiated from std.algorithm.sorting.sort.

--
Jan 23