[Issue 23066] New: importC: can't initialize char array with string literal of different length
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Apr 28 06:48:56 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23066
Issue ID: 23066
Summary: importC: can't initialize char array with string
literal of different length
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: ImportC, rejects-valid
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: duser at neet.fi
CC: duser at neet.fi
char s1[2] = "toolong"; // Error: cannot implicitly convert expression
`"toolong"` of type `char[8]` to `char[2]`
char s2[50] = "tooshort"; // ok
void fn()
{
char s3[2] = "toolong"; // Error: mismatched array lengths, 2 and 8
char s4[50] = "tooshort"; // Error: mismatched array lengths, 50 and 9
}
these worked before https://github.com/dlang/dmd/pull/14027
--
More information about the Digitalmars-d-bugs
mailing list