https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81957
Bug ID: 81957 Summary: ICE decltype Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: roland at rschulz dot eu Target Milestone: --- #include <type_traits> struct f { template<bool b, typename Int> void operator()(std::integral_constant<bool,b>, Int i) { } }; template<bool...Bs, typename F, typename ...T> auto dispatch(F f, T...t) -> decltype(f(std::integral_constant<bool,Bs>()..., t...)) { return f(std::integral_constant<bool,Bs>()..., t...); } template<bool...Bs, typename F, typename ...T> auto dispatch(F f, bool b, T...t) -> decltype(dispatch<Bs..., true>(f, t...)) { if (b) return dispatch<Bs..., true>(f, t...); else return dispatch<Bs..., false>(f, t...); } int main() { dispatch(f(), true, 5); return 0; } gives: Internal compiler error: Error reporting routines re-entered. Without the 2nd decltype (either using void or no return type specification) it compiles fine. The problem is present in all supported GCC versions.