func(NULL);
}
*/
- bool const conversion_warning = !(null_node_p (current_arg)
- && DECL_TEMPLATE_INFO (fn)
- && cand->template_decl
- && !cand->explicit_targs);
+ bool conversion_warning = !(null_node_p (current_arg)
+ && DECL_TEMPLATE_INFO (fn)
+ && cand->template_decl
+ && !cand->explicit_targs);
+
+ /* Also don't warn about (x <=> y) < 0 (c++/100903). */
+ if (conversion_warning
+ && integer_zerop (current_arg)
+ && warn_zero_as_null_pointer_constant
+ && !warning_enabled_at (DECL_SOURCE_LOCATION (fn),
+ OPT_Wzero_as_null_pointer_constant))
+ conversion_warning = false;
tsubst_flags_t const arg_complain
= conversion_warning ? complain : complain & ~tf_warning;
--- /dev/null
+// PR c++/100903
+// { dg-additional-options -Wzero-as-null-pointer-constant }
+// { dg-do compile { target c++20 } }
+
+#include <compare>
+
+int main()
+{
+ return (1.0 <=> 2.0) < 0;
+}