http://d.puremagic.com/issues/show_bug.cgi?id=3646
Summary: Default values of function arguments are ignored when
instantiating a template.
Product: D
Version: 2.035
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Eldar Insafutdinov <[email protected]> 2009-12-25
01:02:49 PST ---
void foo(Fn)(Fn fn)
{
fn();
}
void bar(int i = 22) {
writeln("bar ", i);
}
void bam(int i) {
writeln("bam ", i);
}
void baz() {
foo(&bar);
foo(&bam);
}
This code compiles while it should not. You cannot call bam() without any
arguments. If you switch the instantiations and call foo(&bam) first - it does
not compile.
pragma(msg, typeof(&bar).stringof);
pragma(msg, typeof(&bam).stringof);
outputs
void function(int i = 22)
void function(int i)
But it is not respected by the template.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------