[Issue 3081] New: unaryFun can't be used to get element out of struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 19 09:09:19 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3081

           Summary: unaryFun can't be used to get element out of struct
           Product: D
           Version: 2.030
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


import std.algorithm;

struct Foo {
    uint num;
}

void main() {
    Foo[] foos;
    auto bar = map!("a.num")(foos);
}

C:\dmd\windows\bin\..\..\src\phobos\std\functional.d(89): Error: static assert 
"Bad unary function: a.num for type Foo"

This looks like overzealous error checking, as it worked in the old Phobos and
now fails a static assert.  Probably has to do with the fact that Foo is in a
different module than std.functional.unaryFun.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list