Bug 14904 – [REG2.067.0] bad error message in reduce: 'Incompatible function/seed/element'

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-11T02:02:00Z
Last change time
2017-07-19T17:43:46Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
timothee.cour2

Comments

Comment #0 by timothee.cour2 — 2015-08-11T02:02:42Z
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 } ----
Comment #1 by k.hara.pg — 2015-08-13T10:29:44Z
This is a diagnostic regression introduced in Phobos change: https://github.com/D-Programming-Language/phobos/pull/2060
Comment #2 by k.hara.pg — 2015-08-25T04:42:32Z
Comment #3 by github-bugzilla — 2015-08-25T09:47:42Z
Commits pushed to stable at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/6579c574bbcc53944a2060f3d1eadc1fa5516f51 fix Issue 14904 - bad error message in reduce: 'Incompatible function/seed/element' The verbose message is shown only when the given `fun` is actually valid. https://github.com/D-Programming-Language/phobos/commit/76a5087312382ff0b16840d4c2501dc8ba6abda0 Merge pull request #3580 from 9rnsr/fix14904 [REG2.067.0] Issue 14904 - bad error message in reduce: 'Incompatible function/seed/element'
Comment #4 by github-bugzilla — 2015-09-07T16:46:49Z
Comment #5 by github-bugzilla — 2017-07-19T17:43:46Z
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/6579c574bbcc53944a2060f3d1eadc1fa5516f51 fix Issue 14904 - bad error message in reduce: 'Incompatible function/seed/element' https://github.com/dlang/phobos/commit/76a5087312382ff0b16840d4c2501dc8ba6abda0 Merge pull request #3580 from 9rnsr/fix14904