[Issue 20554] New: std.algorithm.searching.all 's static assert produces a garbled error message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 1 08:51:53 UTC 2020


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

          Issue ID: 20554
           Summary: std.algorithm.searching.all 's static assert produces
                    a garbled error message
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: mipri at minimaltype.com

This invocation of rdmd:

rdmd --eval '"hi".all!isWhite'

yields this error message:

/usr/include/dmd/phobos/std/algorithm/searching.d(125): Error: static assert: 
"sWhit isn't a unary predicate function for range.front"

which complains about 'sWhit' instead of 'isWhite'.

This happens due to

        static assert(is(typeof(unaryFun!pred(range.front))),
                "`" ~ pred.stringof[1..$-1] ~ "` isn't a unary predicate
function for range.front");

which assumes that pred is a string whose .stringof needs to be stripped of
double quotes.

--


More information about the Digitalmars-d-bugs mailing list