Summary: A problem with at compile time
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from 2012-10-04 09:50:38 PDT ---
I am not sure if this is a bug or just a problem in my code:

import std.algorithm: map, reduce;
import std.range: zip;
struct S {}
alias bool function(S) F;
F foo(T)(T) {
    return p => true;
F bar(F r1, F r2) {
    return p => true;
F spam(S[] ps) {
    return zip(ps, ps).map!foo().reduce!bar();
const r1 = spam([S(), S()]); // Error
void main() {
    const r2 = spam([S(), S()]); // OK

Output, DMD 2.061alpha:

...\dmd2\src\phobos\std\conv.d(3393): Error: cannot dereference invalid pointer
...\dmd2\src\phobos\std\range.d(3714):        called from here:
...\dmd2\src\phobos\std\algorithm.d(428):        called from here:
...\dmd2\src\phobos\std\algorithm.d(428):        called from here:
...\dmd2\src\phobos\std\algorithm.d(697):        called from here:
temp.d(12):        called from here: reduce(map(zip(ps,ps)))
temp.d(14):        called from here: spam([S(),S()])

I have asked about it here:

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to