February 28, 2005 char[] and ?: expression | ||||
---|---|---|---|---|
| ||||
<code> void main() { bit b; char[] s1 = b ? "foo" : "foo"; // ok char[] s2 = b ? null : null; // ok char[] s3 = b ? null : "foo"; // error char[] s4 = b ? "foo" : null; // error } </code> str.d(6): cannot convert string literal to void* str.d(6): cannot implicitly convert expression b ? null : cast(void*)("foo") of type void* to char [] str.d(7): cannot convert string literal to void* str.d(7): cannot implicitly convert expression b ? cast(void*)("foo") : null of type void* to char [] // DMD 0.113 |
Copyright © 1999-2021 by the D Language Foundation