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

            Bug ID: 90033
           Summary: [concepts] ICE segfault evaluating a requires clause
                    that transitively depends on itself
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redbeard0531 at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/SEfFol

This is a creduce'd example that tripped a segfault in our Real World Code
implementation of unique_function. The RWC version includes a requirement that
X != Y so this can never be a copy or move constructor, but that was removed in
the reduction. FWIW, The clang concepts fork compiles this successfully.

template <bool B>
struct bool_constant { static constexpr bool value = B; };
template <typename T, typename... Args>
struct is_constructible : bool_constant<__is_constructible(T, Args...)> {};
template <typename T>
T&& move(T&);

struct X {
  template <typename OtherFunc>
  requires(is_constructible<OtherFunc, OtherFunc>::value)
  X(OtherFunc &&);

  X() = default;
};

X source;
X dest = move(source);

---------

<source>: In substitution of 'template<class OtherFunc>  requires 
is_constructible<OtherFunc, OtherFunc>::value X::X(OtherFunc&&) [with OtherFunc
= X]':
<source>:16:21:   required from here
<source>:16:21: internal compiler error: Segmentation fault
   16 | X dest = move(source);
      |                     ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.


I know concepts are still experimental, but if the fix turns out to be simple,
we'd appreciate a backport to gcc8.

Reply via email to