Re: std.typecons.Proxy + inheritance breaks cast'ing to inherited type

2015-03-17 Thread Meta via Digitalmars-d-learn
On Tuesday, 17 March 2015 at 05:32:49 UTC, Ali Çehreli wrote: On 03/16/2015 04:59 PM, Lukasz Wrzosek wrote: Bug reported as https://issues.dlang.org/show_bug.cgi?id=14298 Thanks... I have carried the discussion over to the main newsgroup:

Re: std.typecons.Proxy + inheritance breaks cast'ing to inherited type

2015-03-17 Thread Ali Çehreli via Digitalmars-d-learn
On 03/17/2015 12:14 AM, Meta wrote: On Tuesday, 17 March 2015 at 05:32:49 UTC, Ali Çehreli wrote: On 03/16/2015 04:59 PM, Lukasz Wrzosek wrote: Bug reported as https://issues.dlang.org/show_bug.cgi?id=14298 Thanks... I have carried the discussion over to the main newsgroup:

Re: std.typecons.Proxy + inheritance breaks cast'ing to inherited type

2015-03-17 Thread anonymous via Digitalmars-d-learn
On Tuesday, 17 March 2015 at 07:56:19 UTC, Ali Çehreli wrote: Why can't you do this instead? t opCast(t)() if (is(typeof(cast(T)this))) { return cast(T)this; } That has the same problem: 'cast(T)this' happens to be an explicit cast, which is disabled by the opCast overload for int.

Re: std.typecons.Proxy + inheritance breaks cast'ing to inherited type

2015-03-16 Thread Lukasz Wrzosek via Digitalmars-d-learn
Bug reported as https://issues.dlang.org/show_bug.cgi?id=14298

Re: std.typecons.Proxy + inheritance breaks cast'ing to inherited type

2015-03-16 Thread John Colvin via Digitalmars-d-learn
On Monday, 16 March 2015 at 09:03:18 UTC, Lukasz Wrzosek wrote: Hello I was just exploring possibility to mimic multiple inheritance from C++ (do not ask why, just for fun). I've stumbled on below issue (let's say corner case) and most likely this is bug in implementation of template Proxy,

Re: std.typecons.Proxy + inheritance breaks cast'ing to inherited type

2015-03-16 Thread Lukasz Wrzosek via Digitalmars-d-learn
On Monday, 16 March 2015 at 12:03:12 UTC, John Colvin wrote: What behaviour would you expect if both IA and C inherited from IB? This case should assert at compile time. But my example shows that case with implicit case is working, but the explicit cast is not. That seems to be incorrect

Re: std.typecons.Proxy + inheritance breaks cast'ing to inherited type

2015-03-16 Thread Ali Çehreli via Digitalmars-d-learn
On 03/16/2015 08:28 AM, Lukasz Wrzosek wrote: On Monday, 16 March 2015 at 12:03:12 UTC, John Colvin wrote: What behaviour would you expect if both IA and C inherited from IB? This case should assert at compile time. But my example shows that case with implicit case is working, but the

Re: std.typecons.Proxy + inheritance breaks cast'ing to inherited type

2015-03-16 Thread Ali Çehreli via Digitalmars-d-learn
On 03/16/2015 04:59 PM, Lukasz Wrzosek wrote: Bug reported as https://issues.dlang.org/show_bug.cgi?id=14298 Thanks... I have carried the discussion over to the main newsgroup: http://forum.dlang.org/thread/me8e0a$1kp6$1...@digitalmars.com As I mention there, there is a workaround: Add a

std.typecons.Proxy + inheritance breaks cast'ing to inherited type

2015-03-16 Thread Lukasz Wrzosek via Digitalmars-d-learn
Hello I was just exploring possibility to mimic multiple inheritance from C++ (do not ask why, just for fun). I've stumbled on below issue (let's say corner case) and most likely this is bug in implementation of template Proxy, isn't it ? import std.typecons; class IA {} class IB {} class C