https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117896
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2024-12-03 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Seems like a bug in auto NTTP handling Without the std::lib dependencies: template <typename T, template <T> class other_type> struct S { }; namespace detail { template <typename protocol> struct ot_impl; template <typename T, template <T> class other_type> struct ot_impl<S<T, other_type>> { using type = T; }; } template <auto Q> using get_type = typename detail::ot_impl<decltype(Q)>::type; namespace detail { template <typename Q, get_type<Q{}> V> struct getter_impl; template <typename T, template <T> class other_type, T V> struct getter_impl<S<T, other_type>, V> { using type = typename other_type<V>::type; }; } template <auto Q, get_type<Q> V> using get_other_type = typename detail::getter_impl<decltype(Q), V>::type; template <unsigned char V> struct M { using type = float; }; template<> struct M<0>{ using type = int; }; inline constexpr auto p = S<unsigned char, M>{}; template<typename, typename> constexpr bool is_same_v = false; template<typename T> constexpr bool is_same_v<T,T> = true; int main() { static_assert(is_same_v<get_other_type<p, 0>, int>); static_assert(is_same_v<get_other_type<p, 1>, float>); }