www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14904] New: bad error message in reduce: 'Incompatible

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

          Issue ID: 14904
           Summary: bad error message in reduce: 'Incompatible
                    function/seed/element'
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timothee.cour2 gmail.com

dmd_066 -c -o- main.d:
Error: 'fabs' is not defined, perhaps you need to import std.math; ?

dmd_068 -c -o- main.d:
Error: static assert  "Incompatible function/seed/element:
main.__lambda1/double/double"

main.d:
----
void main(){
  import std.algorithm;
  // import std.math;

  double[]x=[1,2,3];
  auto b=double(0).reduce!((a, b) => a + fabs(b))(x);//bad message with 2.068
  //auto b=x.reduce!((a, b) => a + fabs(b)); //ok: Error: 'fabs' is not defined
}
----

--
Aug 10 2015