August 16, 2003 "Incompatible types" for an array initialization expression: bug? | ||||
---|---|---|---|---|
| ||||
Walter, Given: import c.stdio; int main(char[][] args) { // append null terminator wchar[] text = "Test Text." ~ '\u0000'; return 0; } the compiler says: bug3.d(5): incompatible types for (("Test Text.") ~ (cast(int)(0))): 'char[]' and 'int' however: import c.stdio; int main(char[][] args) { wchar[] text = "Test Text."; text ~= '\u0000'; return 0; } compiles without complaint. Is this a bug? Thanks -- Les Baker |
August 16, 2003 Re: "Incompatible types" for an array initialization expression: bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Les Baker | Yes, it's a bug. You can workaround by turning '\u0000' into "\u0000". "Les Baker" <lesbaker@innovaREMOVETHIS.net> wrote in message news:bhk5ta$tm4$1@digitaldaemon.com... > Walter, > > Given: > import c.stdio; > > int main(char[][] args) > { > // append null terminator > wchar[] text = "Test Text." ~ '\u0000'; > return 0; > } > > the compiler says: > bug3.d(5): incompatible types for (("Test Text.") ~ (cast(int)(0))): > 'char[]' and 'int' > > however: > import c.stdio; > > int main(char[][] args) > { > wchar[] text = "Test Text."; > text ~= '\u0000'; > > return 0; > } > > compiles without complaint. > > Is this a bug? > > Thanks -- Les Baker > > |
Copyright © 1999-2021 by the D Language Foundation