December 13, 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@puremagic.com
        ReportedBy: simen.kjaras@gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras@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: -------
January 14, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9147


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com
           Severity|critical                    |enhancement


--- Comment #1 from yebblies <yebblies@gmail.com> 2013-01-14 15:54:18 EST ---
This is not a bug, it's working as intended.  D does not support implicit construction like this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home