[Issue 1943] New: Templates can't take function pointer parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 25 12:32:11 PDT 2008


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

           Summary: Templates can't take function pointer parameters
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: webmaster at villagersonline.com


dmd 2.012, Linux

dmd rejects code which the spec says should be valid (the spec doesn't mention
any limitations to value parameters):

BEGIN CODE
  template foo(void function() fp /*TPL...*/) {}
  void bar() {}
  alias foo!(&bar) a1;
END CODE

BEGIN dmd OUTPUT
  test.d(1): Error: arithmetic/string type expected for value-parameter, not
void function()
END OUTPUT

BEGIN CODE (2nd manifestation)
  template foo(TPL...) {}
  void bar() {}
  alias foo!(&bar) a1;
END CODE

BEGIN dmd OUTPUT
  test.d(3): Error: expression & bar is not a valid template value argument
  test.d(3): template instance test.foo!(& bar) error instantiating
END OUTPUT


-- 



More information about the Digitalmars-d-bugs mailing list