[Issue 23066] importC: can't initialize char array with string literal of different length

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 30 04:05:45 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=23066

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
char s1[2] = "toolong"; // gcc and clang give a warning on this, dmc gives
error

char s2[50] = "tooshort"; // well, that should work

C11 6.7.9-2 says: No initializer shall attempt to provide a value for an object
not contained within the entity
being initialized.

I interpret that as the s1 example should be an error.

--


More information about the Digitalmars-d-bugs mailing list