[Issue 9147] New: Implicit conversion to struct with alias this does not work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 13 03:49:49 PST 2012


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

           Summary: Implicit conversion to struct with alias this does not
                    work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: simen.kjaras at gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras at gmail.com> 2012-12-13 03:49:44 PST ---
struct bbyte {
    byte b;
    alias b this;
}

void bar(bbyte b) {}

bbyte baz() {
    byte b;
    return b; // cannot implicitly convert expression (b) of type byte to bbyte
}

void main() {
    byte b;
    bar(b); // function bar (bbyte b) is not callable using argument types
(byte)
}

The above code fails on the marked lines as it's trying to convert the byte to
a bbyte. Ref discussion:
http://forum.dlang.org/thread/mailman.2599.1355228650.5162.digitalmars-d@puremagic.com?page=3#post-mailman.2632.1355345407.5162.digitalmars-d:40puremagic.com

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