https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105481
Bug ID: 105481 Summary: ICE: unexpected expression of kind template_parm_index Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chfast at gmail dot com Target Milestone: --- I get intx_reduced.cpp: In substitution of ‘template<unsigned int N, class T, class> uint<N> f(const T&) [with unsigned int N = N; T = uint<N>; <template-parameter-1-3> = <missing>]’: intx_reduced.cpp:18:31: required from here intx_reduced.cpp:13:5: internal compiler error: unexpected expression ‘N’ of kind template_parm_index 13 | typename = typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type> | ^~~~~~~~ for code: #include <type_traits> template <unsigned N> struct uint { int words_[N]; }; template <unsigned N> uint<N> f(const uint<N>& y) noexcept; template <unsigned N, typename T, typename = typename std::enable_if<std::is_convertible<T, uint<N>>::value>::type> uint<N> f(const T& y) noexcept; using X = uint<1>; X (*fp)(X const&) noexcept = &f; The reduced version (cvise): template <typename _Tp, _Tp __v> struct integral_constant { static constexpr _Tp value = __v; }; using true_type = integral_constant<bool, true>; using false_type = integral_constant<bool, false>; template <bool __v> using __bool_constant = integral_constant<bool, __v>; template <bool, typename, typename> struct conditional; template <typename...> struct __or_; template <typename _B1, typename _B2> struct __or_<_B1, _B2> : conditional<_B1::value, _B1, _B2>::type {}; template <typename> struct is_const; template <typename> struct is_array : false_type {}; template <typename _Tp> struct is_function : __bool_constant<!is_const<_Tp>::value> {}; template <typename> struct is_const : true_type {}; template <typename, typename _To, bool = __or_<is_function<_To>, is_array<_To>>::value> struct __is_convertible_helper { template <typename> static true_type __test(int); typedef decltype(__test<_To>(0)) type; }; template <typename _From, typename _To> struct is_convertible : __is_convertible_helper<_From, _To>::type {}; template <bool, typename _Tp = void> struct enable_if { typedef _Tp type; }; template <typename _Iftrue, typename _Iffalse> struct conditional<false, _Iftrue, _Iffalse> { typedef _Iffalse type; }; template <unsigned> struct uint; template <unsigned N> uint<N> f(const uint<N> &); template < unsigned N, typename T, typename = typename enable_if<is_convertible<T, uint<N>>::value>::type> uint<N> f(T); using X = uint<1>; X (*fp)(X const &) = f;