http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57817
Bug ID: 57817 Summary: g++ crashes on handling variadic template sizeof inside lambda funcion Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lb-guilherme at live dot com The following code produces a crash on both GCC 4.7.3 and 4.8.1: template <typename... T> void f(T... a) { [&]{ int s = sizeof...(a); }(); } int main() { f(); } This is the crash report from GCC 4.8.1: test.cpp: In instantiation of 'f(T ...) [with T = {}]::__lambda0': test.cpp:5:5: required from 'struct f(T ...) [with T = {}]::__lambda0' test.cpp:7:5: required from 'void f(T ...) [with T = {}]' test.cpp:12:5: required from here test.cpp:6:19: internal compiler error: Segmentation fault int s = sizeof...(a); ^ 0x850d2f0 crash_signal /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/toplev.c:332 0x814f26b tsubst_copy /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:12114 0x8146ebf tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:14445 0x814ac4a tsubst_expr /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:13385 0x8151246 tsubst_pack_expansion /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:9475 0x814f0ed tsubst_copy /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:12263 0x814843c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:14571 0x814ac4a tsubst_expr /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:13385 0x814c4ed tsubst_expr /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:12943 0x814b98f tsubst_expr /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:13040 0x814b98f tsubst_expr /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:13040 0x814a8ce instantiate_decl(tree_node*, int, bool) /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:18920 0x815e7ed instantiate_class_template_1 /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:9015 0x815e7ed instantiate_class_template(tree_node*) /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:9083 0x81ad52b complete_type(tree_node*) /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/typeck.c:131 0x8147703 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:14542 0x8147cfb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:13951 0x814ac4a tsubst_expr /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:13385 0x814b31a tsubst_expr /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:12864 0x814b4dc tsubst_expr /opt/mxe/tmp-gcc/gcc-4.8.1/gcc/cp/pt.c:12850 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.