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

            Bug ID: 89833
           Summary: [9 Regression] sorry, unimplemented: string literal in
                    function template signature
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: FIXME, rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: msebor at gcc dot gnu.org
  Target Milestone: ---

When compiled with -std=c++2a this started to fail with r269814:

using size_t = decltype(sizeof(0));
template<typename T, size_t N> struct array { T data[N]; };
template<size_t...> struct index_sequence { };
template<size_t> struct make_index_sequence;
template<> struct make_index_sequence<6> : index_sequence<0, 1, 2, 3, 4, 5> {
};

template <size_t N>
struct mystring : array<char, N> {
    template <size_t ...Idx>
    constexpr mystring(const char (&str)[N], index_sequence<Idx...>)
    : array<char, N>{str[Idx]...} {}

    constexpr mystring(const char (&str)[N]) : mystring(str,
make_index_sequence<N>{}) {}
};

template <size_t N>
mystring(const char (&str)[N]) -> mystring<N>;

template <mystring>
struct S {};

S<"Hello"> s;


reg.cc: In instantiation of ‘struct S<mystring<6>{array<char, 6>{"Hello"}}>’:
reg.cc:24:12:   required from here
reg.cc:22:10: sorry, unimplemented: string literal in function template
signature
   22 | struct S {};
      |          ^
reg.cc:22:10: sorry, unimplemented: string literal in function template
signature
reg.cc:22:10: sorry, unimplemented: string literal in function template
signature

Reply via email to