Thread overview
[Issue 23066] importC: cannot initialize char array with string literal of different length
[Issue 23066] importC: can't initialize char array with string literal of different length
Apr 30, 2022
Walter Bright
Apr 30, 2022
Walter Bright
Apr 30, 2022
Dlang Bot
May 06, 2022
Dlang Bot
May 15, 2022
Dlang Bot
April 30, 2022
https://issues.dlang.org/show_bug.cgi?id=23066

Walter Bright <bugzilla@digitalmars.com> changed:

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

--- Comment #1 from Walter Bright <bugzilla@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.

--
April 30, 2022
https://issues.dlang.org/show_bug.cgi?id=23066

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|importC: can't initialize   |importC: cannot initialize
                   |char array with string      |char array with string
                   |literal of different length |literal of different length

--
April 30, 2022
https://issues.dlang.org/show_bug.cgi?id=23066

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright created dlang/dmd pull request #14046 "fix Issue 23066 - importC: cannot initialize char array with string l…" fixing this issue:

- fix Issue 23066 - importC: cannot initialize char array with string literal of different length

https://github.com/dlang/dmd/pull/14046

--
May 06, 2022
https://issues.dlang.org/show_bug.cgi?id=23066

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #14046 "fix Issue 23066 - importC: cannot initialize char array with string l…" was merged into stable:

- 5a55e369dbd8fafa26b6cfbb4627b8d24f5d31bb by Walter Bright:
  fix Issue 23066 - importC: cannot initialize char array with string literal
of different length

https://github.com/dlang/dmd/pull/14046

--
May 15, 2022
https://issues.dlang.org/show_bug.cgi?id=23066

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #14130 "merge stable" was merged into master:

- fbe7bf2a7e2ba8e6e44b3a641b2a7b61d4869d64 by Walter Bright:
  fix Issue 23066 - importC: cannot initialize char array with string literal
of different length (#14046)

https://github.com/dlang/dmd/pull/14130

--