www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8461] New: std.container.SList can't work with std.typecons.Proxy

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

           Summary: std.container.SList can't work with std.typecons.Proxy
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: cpunion gmail.com



code:
---
import std.typecons;
import std.container;

class Foo {
    this(int n) {
        value = n;
    }

    mixin Proxy!(value);

    private int value;
}

void main() {
    SList!Foo list;
    list.insertFront(new Foo(1));
}
---

compiler output:
---
$ dmd testslist.d 
/home/lijie/.dvm/compilers/dmd-2.059/bin/../src/phobos/std/container.d(938):
Error: template testslist.Foo.Proxy!(value).opCast does not match any function
template declaration
/home/lijie/.dvm/compilers/dmd-2.059/bin/../src/phobos/std/typecons.d(2796):
Error: template testslist.Foo.Proxy!(value).opCast(T,this X) cannot deduce
template function from argument types !(Object)()
/home/lijie/.dvm/compilers/dmd-2.059/bin/../src/phobos/std/container.d(938):
Error: template testslist.Foo.Proxy!(value).opCast does not match any function
template declaration
/home/lijie/.dvm/compilers/dmd-2.059/bin/../src/phobos/std/typecons.d(2796):
Error: template testslist.Foo.Proxy!(value).opCast(T,this X) cannot deduce
template function from argument types !(Object)()
testslist.d(15): Error: template instance std.container.SList!(Foo) error
instantiating
---

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




Shorter code:
---
import std.container;

class Foo {
    this(int n) {
        value = n;
    }

    T opCast(T)() {
        return cast(T)value;
    }

    private int value;
}

void main() {
    SList!Foo list;
}
---

compile:
---
$ dmd testslist.d
/home/lijie/.dvm/compilers/dmd-2.059/bin/../src/phobos/std/container.d(938):
Error: function testslist.Foo.opCast!(Object).opCast () is not callable using
argument types ()
/home/lijie/.dvm/compilers/dmd-2.059/bin/../src/phobos/std/container.d(938):
Error: function testslist.Foo.opCast!(Object).opCast () is not callable using
argument types ()
testslist.d(16): Error: template instance std.container.SList!(Foo) error
instantiating
---

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME



Works in 2.063alpha.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 11 2013