https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84796
Bug ID: 84796 Summary: ICE in a template parameter pack expansion Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- The following C++ code causes an ICE in GCC 8.0.1 20180308 (tested with https://godbolt.org/): /************* SOURCE *************/ template<typename... T> struct S { template<T... n> static void f() { } }; int main(){ S<int>::f<0>(); } /*********** END SOURCE ***********/ /************* OUTPUT *************/ <source>: In function 'int main()': <source>:8:18: internal compiler error: tree check: accessed elt 1 of tree_vec with 0 elts in tsubst_pack_expansion, at cp/pt.c:11743 S<int>::f<0>(); ^ mmap: Invalid argument Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1 /*********** END OUTPUT ***********/ Looks like a regression: no ICE occurs with GCC 7.3, but the code is rejected with an error (I believe, incorrectly): /************* OUTPUT *************/ <source>: In function 'int main()': <source>:8:18: error: no matching function for call to 'S<int>::f<0>()' S<int>::f<0>(); ^ <source>:4:17: note: candidate: template<T ...n> static void S<T>::f() [with T ...n = {n ...}; T = {int}] static void f() { } ^ <source>:4:17: note: template argument deduction/substitution failed: Compiler returned: 1 /*********** END OUTPUT ***********/