www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - 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
Feb 28 2005