www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20554] New: std.algorithm.searching.all 's static assert

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 puremagic.com
          Reporter: mipri 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.

--
Feb 01 2020