https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102396
Bug ID: 102396 Summary: ICE when using concepts, in get, at cp/constraint.cc:2637 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dangelog at gmail dot com Target Milestone: --- Hello, This testcase (which gets accepted by Clang and MSVC) causes an ICE under GCC-12-trunk, and an erroneous compilation error on GCC 11.2. #include <memory> #include <span> #include <ranges> #include <concepts> template <typename T> struct S; template <typename C> constexpr bool is_S = false; template <typename T> constexpr bool is_S<S<T>> = true; template <typename T> struct S { T data; S(); explicit S(const T &); template <typename U, std::enable_if_t<!is_S<U>, bool> = false> requires std::equality_comparable_with<T, U> friend bool operator==(const S &s, const U &u) { return s.data == u; } }; template <typename T> bool operator==(const S<T> &a, const S<T> &b) { return a.data == b.data; } int main() { using SD = S<double>; char data[sizeof(SD) * 10]; std::span<SD> span((SD*)std::begin(data), (SD*)std::end(data)); //static_assert(std::equality_comparable<std::span<SD>::iterator>); std::ranges::uninitialized_default_construct(span); } The error: /opt/compiler-explorer/gcc-trunk-20210918/include/c++/12.0.0/concepts:280:17: internal compiler error: in get, at cp/constraint.cc:2637 280 | { __t == __u } -> __boolean_testable; | ~~~~^~~~~~ 0x1fc77b9 internal_error(char const*, ...) ???:0 0x713d19 fancy_abort(char const*, int, char const*) ???:0 0x7970af satisfaction_cache::get() ???:0 0x79cd8a constraints_satisfied_p(tree_node*, tree_node*) ???:0 0x9ba323 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool) ???:0 0x73f150 build_new_op(op_location_t const&, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int) ???:0 0xa2fc50 build_x_binary_op(op_location_t const&, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node**, int) ???:0 0x79cd42 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*) ???:0 0x79cd8a constraints_satisfied_p(tree_node*, tree_node*) ???:0 0x9ba323 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool) ???:0 0x73f150 build_new_op(op_location_t const&, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int) ???:0 0xa2fc50 build_x_binary_op(op_location_t const&, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node**, int) ???:0 0x9816d7 instantiate_decl(tree_node*, bool, bool) ???:0 0x9c3e1b instantiate_pending_templates(int) ???:0 0x82a899 c_parse_final_cleanups() ???:0