https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117658
Bug ID: 117658 Summary: Different behavior between header file and module:invalid 'static_cast' from type 'const char [20]' to type 'no_cvref_t' {aka 'char [20]'} Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: accelerator0099 at gmail dot com Target Milestone: --- Created attachment 59621 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59621&action=edit Sources and script Commit: 45a3277149d95a51cf9109cab87ee39a7dce73e2 Target: x86_64-pc-linux-gnu Configured with: /home/aleck099/git/gcc/configure --prefix=/tmp/x86_64-pc-linux-gnu --disable-nls --disable-werror --enable-languages=c,c++ --enable-multilib --disable-bootstrap --disable-libstdcxx-verbose --enable-libstdcxx-static-eh-pool --with-libstdcxx-eh-pool-obj-count=0 --disable-sjlj-exceptions --enable-libstdcxx-threads --enable-libstdcxx-backtrace reproduce with: $ sh reproduce.sh In legacy we use header files, main2.cc #include fast_io.ii, and everything compiles well. Now we use modules, create fast_io.cc, export some functions from fast_io.ii and use them in main.cc, it suddenly produces: error: invalid 'static_cast' from type 'const char [20]' to type 'no_cvref_t' {aka 'char [20]'} 53 | return static_cast<no_cvref_t>(t); The type of variable t should be fast_io::basic_io_scatter_t<char>>, however it becomes const char[20] when we use modules