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

            Bug ID: 97773
           Summary: gcc crash after some noexcept magic
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janezz55 at gmail dot com
  Target Milestone: ---

clang version 10.0.1 compiles this, but gcc 10.2.0 fails gloriously:

template <typename ...T>
std::size_t hash_combine(T&& ...v) noexcept(noexcept(
  ((hash<std::remove_cvref_t<T>>()(std::declval<T>())), ...)))
{
  auto seed{672807365};

  (
    (
      seed ^= hash<std::remove_cvref_t<T>>()(std::forward<T>(v)) +
        0x9e3779b9 + (seed << 6) + (seed >> 2)
    ),
    ...
  );

  return seed;
}

template <typename ...T>
struct hash<std::tuple<T...>>
{
  auto operator()(std::tuple<T...> const& t) const
  {
    return std::apply(hash_combine<T const&...>, t);
  }
};

internal compiler error: in type_throw_all_p, at cp/except.c:1292

Another bug, I'd like to report is: if I specify auto as the return type of
hash_combine(), then the compiler give this error:

error: no matching function for call to 'apply(<unresolved overloaded function
type>,

but clang compiles, again, without any errors.

Reply via email to