[Issue 10962] New: Wrong implicit conversion of enum in const function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 3 19:53:40 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10962

           Summary: Wrong implicit conversion of enum in const function
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kekeniro2 at yahoo.co.jp


--- Comment #0 from kekeniro2 at yahoo.co.jp 2013-09-03 19:53:37 PDT ---
I have no idea whether this is a very specific case.

class SomeClass {
    enum E : short { init }
    E e1;
    E foo() const {
      //E ret = e1 ? E.init : e1; // OK
      //E e2;
      //return e2 ? E.init : e2; // OK
        return e1 ? E.init : e1; // NG
    }
}

DMD gives:
Error: cannot implicitly convert expression (this.e1 ? 0 : cast(int)this.e1) of
type int to E

-- 
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