[Issue 16399] New: template with func. ptr. argument and anon. func. in the template body, rejects its argument

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 17 07:24:32 PDT 2016


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

          Issue ID: 16399
           Summary: template with func. ptr. argument and anon. func. in
                    the template body, rejects its argument
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: cauterite at gmail.com

( https://dpaste.dzfl.pl/79301f12e5fc )

// ------ Example: ----------

template A(alias Arg) {
    enum A = Arg;
    enum Unrelated = ({return 0;})(); // Error: expression & asdf is not a
valid template value argument
};

void main() {
    enum FnPtr = &asdf;
    enum _ = A!FnPtr;
};

void asdf() {};

// ------------------

remove the "enum Unrelated =" line and it compiles fine.
this also compiles fine: https://dpaste.dzfl.pl/fca15065a4cf

--


More information about the Digitalmars-d-bugs mailing list