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

            Bug ID: 92579
           Summary: compiler rejects list initialization of character
                    array member from string literal in return statement
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michael.kenzel at gmail dot com
  Target Milestone: ---

The following code will reproduce the issue (seems to affect all versions of
gcc that support C++11):

        struct blub
        {
                char a[5];
        };

        blub f()
        {
                return {"asdf"};  // error: could not convert '{"asdf"}' from
'<brace-enclosed initializer list>' to 'blub'
                // return {{'a', 's', 'd', 'f', '\0'}};  // OK
                // return blub {"asdf"};  // OK
        }

Reply via email to