[Issue 8597] New: UFCS fails when used with a pointer to enum and implicit dereferencing

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 28 23:03:05 PDT 2012


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

           Summary: UFCS fails when used with a pointer to enum and
                    implicit dereferencing
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: tommitissari at hotmail.com


--- Comment #0 from Tommi <tommitissari at hotmail.com> 2012-08-28 23:03:03 PDT ---
module main;

enum MyEnum { first, second, third }

MyEnum next(MyEnum myenum)
{
    return cast(MyEnum) (myenum + 1);
}

void main()
{
    auto myenum = MyEnum.second;
    auto ptrEnum = &myenum;

    auto maxEnum      =   ptrEnum.max;     // #0: OK
    auto nextExplicit = (*ptrEnum).next(); // #1: OK
    auto nextImplicit =   ptrEnum.next();  // #2
}

#2: Error: function main.next (MyEnum myenum) is not callable using argument
types (MyEnum*)

#2: Error: cannot implicitly convert expression (ptrEnum) of type MyEnum* to
MyEnum

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