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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-reduction             |

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
And here's a reduced version of there original test.  Will try to reduce
further.

template <typename> struct remove_cv { using type = int; };
template <typename _Tp> using __remove_cvref_t = typename remove_cv<_Tp>::type;
template <typename _Tp> using remove_cvref_t = __remove_cvref_t<_Tp>;
template <typename _Derived, typename _Base>
concept derived_from = __is_base_of(_Base, _Derived);
template <typename> struct iterator_traits;
struct input_iterator_tag;
namespace __detail {
template <typename> struct __iter_traits_impl {
  using type = iterator_traits<int>;
};
template <typename _Iter>
using __iter_traits = typename __iter_traits_impl<_Iter>::type;
template <typename _Tp>
using __iter_diff_t = typename __iter_traits<_Tp>::difference_type;
} // namespace __detail
template <typename _Tp>
using iter_difference_t = __detail::__iter_diff_t<remove_cvref_t<_Tp>>;
namespace __detail {
template <typename> struct __iter_concept_impl;
template <typename _Iter> requires requires { typename _Iter; }
struct __iter_concept_impl<_Iter> {
  using type = typename __iter_traits<_Iter>::iterator_concept;
};
template <typename _Iter>
using __iter_concept = typename __iter_concept_impl<_Iter>::type;
} // namespace __detail
template <typename _Iter> concept weakly_incrementable = requires(_Iter __i) {
  __i;
};
template <typename _Iter>
concept input_iterator =
    derived_from<__detail::__iter_concept<_Iter>, input_iterator_tag>;
template <typename> struct iterator_traits {
  using iterator_concept = input_iterator_tag;
  using difference_type = int;
};
template <typename> struct in_out_result {};
template <typename, typename _Out> using copy_n_result = in_out_result<_Out>;
struct {
  template <input_iterator _Iter, weakly_incrementable _Out>
  constexpr copy_n_result<_Iter, _Out>
  operator()(_Iter __first, iter_difference_t<_Iter> __n, _Out __result) {
    for (; __n; --__n, ++__result)
      *__result = *__first;
    return {};
  }
} copy_n;
template <int N> struct StringLiteral {
  constexpr StringLiteral(const char (&str)[N]) { copy_n(str, N, value); }
  char value[N];
};
template <StringLiteral> struct string {
  constexpr bool operator==(const string &) const = default;
};
template <StringLiteral L2> void operator+(string<L2>) {
  char value[1];
  StringLiteral{value};
}
static_assert(string<"hello, world">{} == string<"hello"
                                                 ", world">{});
static_assert(string<"a rose is a rose is a rose">{} == string<"a rose"
                                                               " is "
                                                               "a rose"
                                                               " is "
                                                               "a rose">{});

Reply via email to