[Bug c++/82249] New: mismatched argument pack lengths leads to ICE
benni.buch at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 19 10:26:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82249
Bug ID: 82249
Summary: mismatched argument pack lengths leads to ICE
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: benni.buch at gmail dot com
Target Milestone: ---
template < typename ... Ds >
constexpr auto f(Ds ...)noexcept{
return [](auto ... n){
constexpr auto calc =
[](auto n, auto dim)noexcept{ return dim; };
return (calc(n, Ds{}), ...);
}(Ds{} ...);
}
int main(){
f(); // Wrong error
f(0, 0); // Wrong error
f(0); // ICE
}
$ g++ -std=c++1z gcc-test.cpp
gcc-test.cpp: In instantiation of 'constexpr auto f(Ds ...) [with Ds = {}]':
gcc-test.cpp:11:4: required from here
gcc-test.cpp:5:30: error: mismatched argument pack lengths while expanding
'calc(n, Ds{})'
return (calc(n, Ds{}), ...);
^
gcc-test.cpp: In instantiation of 'constexpr auto f(Ds ...) [with Ds = {int,
int}]':
gcc-test.cpp:12:8: required from here
gcc-test.cpp:5:30: error: mismatched argument pack lengths while expanding
'calc(n, Ds{})'
gcc-test.cpp: In instantiation of 'f(Ds ...) [with Ds = {int}]::<lambda(auto:1
...)> [with auto:1 = {int}]':
gcc-test.cpp:6:4: required from 'constexpr auto f(Ds ...) [with Ds = {int}]'
gcc-test.cpp:13:5: required from here
gcc-test.cpp:5:16: internal compiler error: Segmentation fault
return (calc(n, Ds{}), ...);
~~~~^~~~~~~~~
0xf4671f crash_signal
../../gcc/gcc/toplev.c:341
0xa8c200 tree_check5(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code, tree_code, tree_code)
../../gcc/gcc/tree.h:3190
0xa8c200 process_outer_var_ref(tree_node*, int)
../../gcc/gcc/cp/semantics.c:3306
0xa56311 tsubst_copy
../../gcc/gcc/cp/pt.c:14821
0xa42bd5 tsubst_copy
../../gcc/gcc/cp/pt.c:14643
0xa42bd5 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:18125
0xa430f5 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:17522
0xa5125f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16959
0xa5125f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16697
0x6453e1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15915
0x6453e1 gen_elem_of_pack_expansion_instantiation
../../gcc/gcc/cp/pt.c:11144
0x6453e1 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11602
0xa5443c tsubst_fold_expr_pack
../../gcc/gcc/cp/pt.c:11223
0xa5443c tsubst_unary_right_fold
../../gcc/gcc/cp/pt.c:11339
0xa5443c tsubst_copy
../../gcc/gcc/cp/pt.c:15259
0xa4439c tsubst_copy
../../gcc/gcc/cp/pt.c:14643
0xa4439c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:18251
0xa5125f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16959
0xa5125f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16697
0xa5108c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15940
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ g++ --version
g++ (GCC) 8.0.0 20170919 (experimental)
More information about the Gcc-bugs
mailing list