2019-12-11 Jason Merrill <jason@redhat.com>
+ PR c++/92774 - ICE with implicitly deleted operator<=>.
+ * method.c (comp_info::~comp_info): Factor out of...
+ (build_comparison_op): Here. Handle error return from build_new_op.
+
PR c++/92859 - ADL and bit-field.
* name-lookup.c: Use unlowered_expr_type.
if (noex && !expr_noexcept_p (expr, tf_none))
noex = false;
}
+
+ ~comp_info ()
+ {
+ if (first_time)
+ {
+ DECL_DECLARED_CONSTEXPR_P (fndecl) = constexp || was_constexp;
+ tree raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fndecl));
+ if (!raises || UNEVALUATED_NOEXCEPT_SPEC_P (raises))
+ {
+ raises = noex ? noexcept_true_spec : noexcept_false_spec;
+ TREE_TYPE (fndecl) = build_exception_variant (TREE_TYPE (fndecl),
+ raises);
+ }
+ }
+ }
};
/* Build up the definition of a defaulted comparison operator. Unlike other
if (complain & tf_error)
inform (info.loc, "cannot default compare union %qT", ctype);
DECL_DELETED_FN (fndecl) = true;
+ return;
}
tree compound_stmt = NULL_TREE;
NULL_TREE);
tree comp = build_new_op (info.loc, code, flags, lhs_mem, rhs_mem,
NULL_TREE, NULL, complain);
+ if (comp == error_mark_node)
+ {
+ DECL_DELETED_FN (fndecl) = true;
+ continue;
+ }
comps.safe_push (comp);
}
if (code == SPACESHIP_EXPR && is_auto (rettype))
finish_compound_stmt (compound_stmt);
else
--cp_unevaluated_operand;
-
- if (info.first_time)
- {
- DECL_DECLARED_CONSTEXPR_P (fndecl) = info.constexp || info.was_constexp;
- tree raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fndecl));
- if (!raises || UNEVALUATED_NOEXCEPT_SPEC_P (raises))
- {
- raises = info.noex ? noexcept_true_spec : noexcept_false_spec;
- TREE_TYPE (fndecl) = build_exception_variant (TREE_TYPE (fndecl),
- raises);
- }
- }
}
/* Synthesize FNDECL, a non-static member function. */
--- /dev/null
+// PR c++/92774
+// { dg-do compile { target c++2a } }
+
+#include <compare>
+
+template<typename T>
+struct X { };
+
+template<typename T>
+bool operator==(const X<T>&, const X<T>&) { return true; }
+template<typename T>
+bool operator<(const X<T>&, const X<T>&) { return true; }
+
+struct Y
+{
+ int a;
+ X<int> c;
+
+ auto operator <=>(Y const&) const = default; // { dg-error "no match" }
+};
+
+void f()
+{
+ auto x = Y() < Y(); // { dg-error "deleted" }
+}