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

            Bug ID: 97852
           Summary: Parameter pack not found
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lf-bt at thax dot hardliners.org
  Target Milestone: ---

The following C++ code compiles fine with clang and msvc without changes, but 
g++ generates 
  error: expected parameter pack before '...'
which does not help at all. The problem is also reproducible with gcc-8 and in
c++11 mode (with some alterations, e.g. non-std index_sequence impl), which
does would allow auto return type deduction used in the second workaround.
(also https://godbolt.org/z/3qPjvn ):

#include <utility>

template <typename T, T... Vals>
struct table256 {
  static constexpr const T data[256] = { Vals... };
};
template <typename T, T... Vals> constexpr const T table256<T,
Vals...>::data[256];

template <typename Str>
constexpr int find_value(Str str, char val)
{
  for (int i = 0; i < (int)str.size; i++) {
    if (str.data[i] == val) {
      return i;
    }
  }
  return -1;
}

template <typename Str, std::size_t... Is>
constexpr auto make_lookup_table256_impl(Str str, std::index_sequence<Is...>)
  -> table256<decltype(find_value(str, 0)), find_value(str, Is)...>
//  -> table256<decltype(find_value(str, 0)), find_value(Str{}, Is)...>  //
workaround 1
{
//  return table256<decltype(find_value(str, 0)), find_value(str, Is)...>{}; 
// workaround 2
  return {};
}
  • [Bug c++/97852] New: Paramet... lf-bt at thax dot hardliners.org via Gcc-bugs

Reply via email to