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


Stewart Gordon <s...@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, spec
                 CC|                            |s...@iname.com
            Version|2.035                       |1.051
             Blocks|                            |340
         OS/Version|Linux                       |All


--- Comment #3 from Stewart Gordon <s...@iname.com> 2010-01-03 08:53:39 PST ---
I've never heard of default arguments being part of the function type's
properties.  I'd probably guessed that the type is simply void function(int)
but default arguments are filled in on the caller side.  In which case the
functions are the same type, and so this isn't meant to work.  Either way, it's
certainly a bug that the code is accepted.

And it applies to D1 too, but the code needs changing a bit:
----------
import std.stdio;

void foo(Fn)(Fn fn) {
    fn();
}

void bar(int i = 22) {
    writefln("bar ", i);
}
void bam(int i) {
    writefln("bam ", i);
}

void main() {
    foo(&bar);
    foo(&bam);
}
----------

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

Reply via email to