[Bug c/107926] New: wrong error message for excess elements in array initializer using a string literal

stephenheumann at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 30 01:33:04 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107926

            Bug ID: 107926
           Summary: wrong error message for excess elements in array
                    initializer using a string literal
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stephenheumann at gmail dot com
  Target Milestone: ---

char s[5] = {"abc",1};

gives the following error message:

<source>:1:20: error: excess elements in struct initializer
    1 | char s[5] = {"abc",1};
      |                    ^
<source>:1:20: note: (near initialization for 's')

There is no struct involved here, so the message is incorrect. It should
probably be 
"excess elements in array initializer".


More information about the Gcc-bugs mailing list