[Issue 10237] std.typecons.Proxy doesn't work with overloaded member function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 2 03:46:28 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10237
Kenji Hara <k.hara.pg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|std.typecons.Proxy doesn't |std.typecons.Proxy doesn't
|work with @property |work with overloaded member
| |function
--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2013-06-02 03:46:26 PDT ---
The root issue is : std.typecons.Proxy does not consider the case which
forwarding target is overloaded member function.
This is essential test code.
struct A(T)
{
private:
T* _p;
ref auto _instance() inout { return *cast( inout(T) *)_p; }
ref auto _instance() immutable { return *cast( immutable(T) *)_p; }
ref auto _instance() shared { return *cast( shared(T) *)_p; }
ref auto _instance() const shared { return *cast(const(shared(T))*)_p; }
public:
//import std.typecons;
//mixin Proxy!(_instance);
pragma(msg, typeof(_instance.foo)); // L17 problem1
pragma(msg, __traits(getOverloads, _instance, "foo").length); // L28
problem2
}
void main()
{
static struct Foo { @property int foo(){ return 0; } }
alias AFoo = A!Foo;
AFoo af;
}
In above, L17 and L18 are mostly same check as Proxy does. They try to test
_instance.foo ==> _instance().foo, but the places L17 and L18 have no valid
'this' context. So, compiler cannot determine actual function from overloaded
_instance call, then reports ambiguity.
--
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