Thread overview
[Issue 1943] New: Templates can't take function pointer parameters
Mar 25, 2008
d-bugmail
Jul 13, 2009
Daniel Keep
Jan 22, 2012
Walter Bright
March 25, 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@digitalmars.com
        ReportedBy: webmaster@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


-- 

July 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1943


Daniel Keep <daniel.keep+d.puremagic.com@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec
                 CC|                            |daniel.keep+d.puremagic.com
                   |                            |@gmail.com




--- Comment #1 from Daniel Keep <daniel.keep+d.puremagic.com@gmail.com>  2009-07-12 21:55:06 PDT ---
This has just cropped up on IRC.  Either the compiler should be fixed to match the spec, or the spec should be changed to match the compiler's behaviour.

The simplest thing to do would be to change to spec to indicate that only strings, ints and floats are allowed as value parameters.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1943



--- Comment #2 from github-bugzilla@puremagic.com 2012-01-22 01:03:33 PST ---
Commit pushed to https://github.com/D-Programming-Language/d-programming-language.org

https://github.com/D-Programming-Language/d-programming-language.org/commit/5b1b3d5e5b9947fe8e9472d89250f6c12c2e9cf5 fix Issue 1943 - Templates can't take function pointer parameters

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1943


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


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