https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118390
Bug ID: 118390 Summary: #embed vs std::to_array<char>/std::initializer_list<char> Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Created attachment 60086 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60086&action=edit testcase: -std=gnu++20 With the attached testcase, GCC outputs: ``` <source>: In function 'int main()': <source>:12:67: error: too many initializers for 'char [4]' 12 | static constexpr auto std_to_char_array = std::to_array<char>({ | ~~~~~~~~~~~~~~~~~~~^~ 13 | #embed __FILE__ | ~~~~~~~~~~~~~~~ 14 | , '\0' | ~~~~~~ 15 | }); | ~~ <source>:19:5: error: narrowing conversion of ''raw_data_cst' not supported by dump_expr<expression error>' from 'int' to 'char' [-Wnarrowing] 19 | }; | ^ ``` Forwarded from reddit (https://www.reddit.com/r/cpp/comments/1hxdv17/experimenting_with_embed/) .