Bug 57817 - g++ crashes on handling variadic template sizeof inside lambda funcion
Summary: g++ crashes on handling variadic template sizeof inside lambda funcion
Status: RESOLVED DUPLICATE of bug 55914
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: c++-lambda
Depends on:
Blocks: lambdas
  Show dependency treegraph
 
Reported: 2013-07-04 01:42 UTC by Guilherme Bernal
Modified: 2022-03-11 00:32 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guilherme Bernal 2013-07-04 01:42:24 UTC
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.
Comment 1 Paolo Carlini 2013-07-04 08:32:10 UTC
Dup.

*** This bug has been marked as a duplicate of bug 55914 ***