www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7808] New: Nullable's alias this does not work with structs containing classes

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7808

           Summary: Nullable's alias this does not work with structs
                    containing classes
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jmdavisProg gmx.com



PDT ---
This code compiled just fine with 2.058

import std.typecons;

void main()
{
    auto s = Nullable!S(S(new C));
    func(s);
}

class C
{
}

struct S
{
    C c;

    this(C c)
    {
        this.c = c;
    }
}

void func(S s)
{
}


But it fails to compile with the latest dmd, giving the error

q.d(6): Error: function q.func (S s) is not callable using argument types
(Nullable!(S))
q.d(6): Error: cannot implicitly convert expression (s) of type Nullable!(S) to
S

It works if the member variable is an int or string. It works if the member
variable is a struct type which does _not_ have a class as a member variable.
But if the struct has a member variable which is a class, or it has a member
variable which is a struct which has a member variable which is a class, then
it fails.

Nullable!S' alias this should convert it to an S when passed to func, but it
doesn't when S contains a member variable which is a class - either directly or
indirectly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 01 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7808


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid



https://github.com/D-Programming-Language/dmd/pull/857

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 02 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7808




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/b90543ea6d93aec7963004261e8fa749b0bdbf35


Issue 7808 - Nullable's alias this does not work with structs containing
classes

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7808


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2012