https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71640

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
One could also argue that this is an accept invalid issue:

markus@x4 tmp % cat llvm.ii
template <typename _Tp> struct integral_constant {
  static constexpr _Tp value = 0;
};
template <int> using __bool_constant = integral_constant<int>;
struct A : integral_constant<int> {};
template <template <typename> class, template <typename> class>
using __detected_or_t_ = struct __undefined;
template <typename> using __replace_first_arg_t = __undefined;
struct B {
  template <typename _Alloc> using __rebind = typename _Alloc::other;
};
template <typename, typename>
using __alloc_rebind = __detected_or_t_<__replace_first_arg_t, B::__rebind>;
namespace __detail {
template <int, int, int> struct _Hashtable_traits {
  using __hash_cached = __bool_constant<0>;
};
template <typename, int> struct _Hash_node;
struct _Prime_rehash_policy;
template <int> struct C;
template <typename, typename> struct _Rehash_base {};
}
template <typename, typename> using __cache_default = A;
template <typename>
struct _Hashtable
    : __detail::_Rehash_base<
          __detail::_Prime_rehash_policy,
          __alloc_rebind<int, __detail::_Hash_node<
                                  int, __detail::_Hashtable_traits<
                                           0, 0, 0>::__hash_cached::value>>> {
  template <int, int> friend struct __detail::C;
};
template <int> using __uset_traits = __detail::_Hashtable_traits<0, 0, 0>;
template <typename _Value, typename _Hash = _Value,
          typename _Tr = __uset_traits<__cache_default<_Value, _Hash>::value>>
using __uset_hashtable = _Hashtable<_Tr>;
__uset_hashtable<int> value_type;


markus@x4 tmp % icpc -c -std=c++14 llvm.ii
llvm.ii(31): warning #549: too many template parameters -- does not match
previous declaration (declared at line 20)
    template <int, int> friend struct __detail::C;
                      ^

markus@x4 tmp % clang++ -c -std=c++14 llvm.ii
llvm.ii:31:3: error: too many template parameters in template redeclaration
  template <int, int> friend struct __detail::C;
  ^~~~~~~~~~~~~~~~~~~
llvm.ii:37:23: note: in instantiation of template class
'_Hashtable<__detail::_Hashtable_traits<0, 0, 0> >' requested here
__uset_hashtable<int> value_type;
                      ^
llvm.ii:20:1: note: previous template declaration is here
template <int> struct C;
^~~~~~~~~~~~~~
1 error generated.
markus@x4 tmp % g++ -Wall -Wextra -c -std=c++14 llvm.ii
markus@x4 tmp %

Reply via email to