www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1943] New: Templates can't take function pointer parameters

reply d-bugmail puremagic.com writes:
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


-- 
Mar 25 2008
next sibling parent d-bugmail puremagic.com writes:
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





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: -------
Jul 12 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1943




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: -------
Jan 22 2012
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Jan 22 2012