chain(const(array of class)) fails
Marc Schütz via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Feb 2 01:51:52 PST 2016
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.
More information about the Digitalmars-d-learn
mailing list