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

--- Comment #0 from 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:
------- You are receiving this mail because: -------

Reply via email to