Created attachment 779639 [details] Dynamics.cpp.ii $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/11.3.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-11.3.0/work/gcc-11.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/11.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/11.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/11.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/11.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/11.3.0/python --enable-languages=c,c++,go,objc,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=yes --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 11.3.0 p4' --disable-esp --enable-libstdcxx-time --with-build-config=bootstrap-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --disable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --without-zstd --enable-lto --with-isl --disable-isl-version-check --enable-default-pie --enable-default-ssp Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.3.0 (Gentoo 11.3.0 p4) $ g++ Dyamics.cpp.ii Dynamics.cpp.ii:1:11: error: ‘_Nm’ has not been declared 1 | template <_Nm> struct array; | ^~~ Dynamics.cpp.ii:3:9: error: expected ‘;’ at end of member declaration 3 | TVec3() array<> data | ^ | ; Dynamics.cpp.ii:3:17: error: wrong number of template arguments (0, should be 1) 3 | TVec3() array<> data | ^ Dynamics.cpp.ii:1:23: note: provided for ‘template<<typeprefixerror><anonymous> > struct array’ 1 | template <_Nm> struct array; | ^~~~~ Dynamics.cpp.ii:3:19: error: expected ‘;’ at end of member declaration 3 | TVec3() array<> data | ^~~~ | ; Dynamics.cpp.ii:4:2: error: expected ‘;’ after struct definition 4 | } using Vec3 = TVec3; | ^ | ; Dynamics.cpp.ii:6:26: error: expected ‘;’ at end of member declaration 6 | Vec3 angular_velocity {} | ^ | ; Dynamics.cpp.ii:5:1: error: new types may not be defined in a return type 5 | struct RotationalState { | ^~~~~~ Dynamics.cpp.ii:5:1: note: (perhaps a semicolon is missing after the definition of ‘RotationalState’) Dynamics.cpp.ii: In function ‘RotationalState EmulatePoint()’: Dynamics.cpp.ii:9:13: error: expected ‘;’ at end of input 9 | state = {} | ^ | ; Dynamics.cpp.ii:9:13: error: expected ‘}’ at end of input Dynamics.cpp.ii:7:18: note: to match this ‘{’ 7 | } EmulatePoint() { | ^ Dynamics.cpp.ii:9:13: warning: no return statement in function returning non-void [-Wreturn-type] 9 | state = {} | ^ Dynamics.cpp.ii:9:9: internal compiler error: in cp_gimplify_expr, at cp/cp-gimplify.c:718 9 | state = {} | ~~~~~~^~~~ 0x7b789e cp_gimplify_expr(tree_node**, gimple**, gimple**) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/cp/cp-gimplify.c:718 0x12b01fe gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:14048 0xaa29ff gimplify_init_ctor_preeval /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:4546 0xaa2aec gimplify_init_ctor_preeval /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:4532 0x186cfdf gimplify_init_constructor /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:5127 0x12bf7a7 gimplify_modify_expr /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:5784 0x12b05f2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:14139 0x12aff38 gimplify_stmt(tree_node**, gimple**) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:6888 0x1879dec gimplify_cleanup_point_expr /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:6630 0x12b1552 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:14532 0x12b0645 gimplify_stmt(tree_node**, gimple**) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:6888 0x12b0645 gimplify_statement_list /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:1880 0x12b0645 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:14584 0x12aff38 gimplify_stmt(tree_node**, gimple**) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:6888 0x183d7fd gimplify_bind_expr /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:1422 0x12b18ab gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:14340 0x12aff38 gimplify_stmt(tree_node**, gimple**) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:6888 0x183a441 gimplify_body(tree_node*, bool) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:15363 0x183a18c gimplify_function_tree(tree_node*) /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/gimplify.c:15517 0x1839e43 cgraph_node::analyze() /usr/src/debug/sys-devel/gcc-11.3.0/gcc-11.3.0/gcc/cgraphunit.c:670 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://bugs.gentoo.org/> for instructions. In the process of checking gcc.git.
My bet is on https://gcc.gnu.org/PR104583
(In reply to Sergei Trofimovich from comment #1) > My bet is on https://gcc.gnu.org/PR104583 Thanks! I can confirm the patch there seems to fix the issue, it simply errors out as expected: $ g++ Dynamics.cpp.ii Dynamics.cpp.ii:1:11: error: ‘_Nm’ has not been declared 1 | template <_Nm> struct array; | ^~~ Dynamics.cpp.ii:3:9: error: expected ‘;’ at end of member declaration 3 | TVec3() array<> data | ^ | ; Dynamics.cpp.ii:3:17: error: wrong number of template arguments (0, should be 1) 3 | TVec3() array<> data | ^ Dynamics.cpp.ii:1:23: note: provided for ‘template<<typeprefixerror><anonymous> > struct array’ 1 | template <_Nm> struct array; | ^~~~~ Dynamics.cpp.ii:3:19: error: expected ‘;’ at end of member declaration 3 | TVec3() array<> data | ^~~~ | ; Dynamics.cpp.ii:4:2: error: expected ‘;’ after struct definition 4 | } using Vec3 = TVec3; | ^ | ; Dynamics.cpp.ii:6:26: error: expected ‘;’ at end of member declaration 6 | Vec3 angular_velocity {} | ^ | ; Dynamics.cpp.ii:5:1: error: new types may not be defined in a return type 5 | struct RotationalState { | ^~~~~~ Dynamics.cpp.ii:5:1: note: (perhaps a semicolon is missing after the definition of ‘RotationalState’) Dynamics.cpp.ii: In function ‘RotationalState EmulatePoint()’: Dynamics.cpp.ii:9:13: error: expected ‘;’ at end of input 9 | state = {} | ^ | ; Dynamics.cpp.ii:9:13: error: expected ‘}’ at end of input Dynamics.cpp.ii:7:18: note: to match this ‘{’ 7 | } EmulatePoint() { | ^ Dynamics.cpp.ii:9:13: warning: no return statement in function returning non-void [-Wreturn-type] 9 | state = {} | ^ Somewhat strangely (to me), with the patch Dolphin builds successfully and doesn't hit the above errors, despite ICEing on code that was reduced to code that produces the above errors.
Fixed in 12/13.