[Issue 8844] New: Warning for bug-prone operator overloading
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 17 15:46:16 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8844
Summary: Warning for bug-prone operator overloading
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: diagnostic
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2012-10-17 15:46:15 PDT ---
struct Foo {
Foo opBinary(string op="-")(Foo f) {
return Foo();
}
}
void main() {
auto Foo = Foo() + Foo();
}
Compiles and run with no errors, dmd 2.061alpha, because "-" is a default
argument for the op template argument, so that code is formally correct. But
I'd like a warning here (or an error?), because I think such code is bug-prone.
--
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