[Issue 7603] New: Default initializer is allowed on ref/out params
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 27 18:44:36 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7603
Summary: Default initializer is allowed on ref/out params
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-02-27 18:44:34 PST ---
void test1(ref bool val = true) {
}
void test2(out bool val = true) {
}
void main()
{
bool x;
test1(x); // compiles ok
test2(x); // compiles ok
test1(); // Error: constant true is not an lvalue
test2(); // Error: constant true is not an lvalue
}
The compiler should probably disallow that kind of function signature
regardless of any calls. The initializer doesn't really do anything.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list