digitalmars.D.bugs - [Issue 8430] New: [2.060 beta] Default arguments ignored for delegates/function pointers
- d-bugmail puremagic.com (31/31) Jul 24 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8430
- d-bugmail puremagic.com (23/23) Jul 24 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8430
- d-bugmail puremagic.com (13/13) Jul 24 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8430
http://d.puremagic.com/issues/show_bug.cgi?id=8430 Summary: [2.060 beta] Default arguments ignored for delegates/function pointers Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: regression Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: sludwig outerproduct.org PDT --- The following used to work in 2.059. Not sure if default args are supposed to work at all, but in case they are not, they should not be accepted at declaration site in the first place. --- void main() { void delegate(int arg = 0) del; del(); // error void function(int arg = 0) fun; fun(); // error } --- delegate_defarg.d(4): Error: expected 1 function arguments, not 0 delegate_defarg.d(7): Error: expected 1 function arguments, not 0 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 24 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8430 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com PDT --- They shouldn't be accepted at the declaration site. Default arguments for function pointers and delegates make no sense. The only time that default function arguments are used is when you call a function by its name and you don't give all of the arguments, in which case the default arguments are effectively copy-pasted at the call site. As function pointers and delegates aren't named (variables referring to them may be, but they themselves aren't), and default arguments aren't part of a function's type, there's no way to call them with default arguments without the compiler special casing situations like the one that you give here. Now, even given all of that, I don't think that this is a regression. The fact that it complains at the call site and didn't before is a bug fix, not a bug. And it's never complained at the declaration site, so not complaining is exactly what it's been doing, so it can't be a regression even though it's a bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 24 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8430 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |DUPLICATE 23:01:48 PDT --- See the discussion for bug 3866. *** This issue has been marked as a duplicate of issue 3866 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 24 2012