https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77655
Bug ID: 77655 Summary: ICE on invalid c++ code on x86_64-linux-gnu (internal compiler error: Segmentation fault (program cc1plus)) Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Target Milestone: --- $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.0 20160919 (experimental) [trunk revision 240232] (GCC) $ $ gcc-trunk small.C small.C: In instantiation of ‘decltype (g(0, (g<decltype(h::a)>)(h::a)...)) h(A&& ...) [with A = {}; decltype (g(0, (g<decltype(h::a)>)(h::a)...)) = void; decltype (a) = ]’: small.C:8:5: required from here small.C:4:4: error: no matching function for call to ‘h(h(A&& ...) [with A = {}; decltype (g(0, (g<decltype(h::a)>)(h::a)...)) = void; decltype (a) = ]::<lambda()>)’ h([] {}); ~^~~~~~~ small.C:3:6: note: candidate: template<class ... A> decltype (g(0, (g<decltype(h::a)>)(h::a)...)) h(A&& ...) auto h(A &&... a) -> decltype(g(0, g<decltype(a)>(a)...)) { ^ small.C:3:6: note: template argument deduction/substitution failed: gcc-trunk: internal compiler error: Segmentation fault (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. $ $ cat small.C template <class F> void g(F); template <class... A> auto h(A &&... a) -> decltype(g(0, g<decltype(a)>(a)...)) { h([] {}); } int main() { h(); return 0; } $