Re: chain(const(array of class)) fails

2016-02-02 Thread SimonN via Digitalmars-d-learn
On Tuesday, 2 February 2016 at 10:58:35 UTC, Marc Schütz wrote: The constraint that fails is the one with `CommonType`: `CommonType` uses the `?:` operator to derive the common type: I filed a bug report: https://issues.dlang.org/show_bug.cgi?id=15638 Interesting reduced case, so it wasn't cha

Re: chain(const(array of class)) fails

2016-02-02 Thread Marc Schütz via Digitalmars-d-learn
On Tuesday, 2 February 2016 at 09:51:52 UTC, Marc Schütz wrote: The constraint that fails is the one with `CommonType`: pragma(msg, CommonType!(const(B), const(C))); // void `CommonType` uses the `?:` operator to derive the common type: writeln(true ? b : c); // Error: incompatible

Re: chain(const(array of class)) fails

2016-02-02 Thread Marc Schütz via Digitalmars-d-learn
The constraint that fails is the one with `CommonType`: pragma(msg, CommonType!(const(B), const(C))); // void `CommonType` uses the `?:` operator to derive the common type: writeln(true ? b : c); // Error: incompatible types for ((b) : (c)): 'const(B[])' and 'const(C[])' write

Re: chain(const(array of class)) fails

2016-02-01 Thread SimonN via Digitalmars-d-learn
Sorry for late reply -- but I got around to test a couple more cases! On Monday, 1 February 2016 at 00:19:44 UTC, Nicholas Wilson wrote: Unqaul means remove any const or immutable torn the type Okay, that sounds like our 'const' shouldn't matter. 'const' is the outermost qualifier, and strip

Re: chain(const(array of class)) fails

2016-01-31 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 31 January 2016 at 21:22:06 UTC, SimonN wrote: Hi, we start with the following code snippet, which works. import std.algorithm; import std.range; import std.stdio; class A { int val; } class B : A { this() { val = 3; } } class C : A { this() { val = 4; }

chain(const(array of class)) fails

2016-01-31 Thread SimonN via Digitalmars-d-learn
Hi, we start with the following code snippet, which works. import std.algorithm; import std.range; import std.stdio; class A { int val; } class B : A { this() { val = 3; } } class C : A { this() { val = 4; } } B[] b = [new B(), new B()]; C[] c = [new C(), ne