chain(const(array of class)) fails
Marc Schütz via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Feb 2 02:58:35 PST 2016
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 types for ((b) : (c)): 'const(B[])'
> and 'const(C[])'
> writeln(true ? b[0] : c[0]);
> // Error: incompatible types for ((b[0]) : (c[0])):
> 'const(B)' and 'const(C)'
>
> At the moment I can't see a reason why that shouldn't work.
This change broke it:
https://github.com/D-Programming-Language/dmd/pull/125
I filed a bug report:
https://issues.dlang.org/show_bug.cgi?id=15638
More information about the Digitalmars-d-learn
mailing list