// P0847R7 // { dg-do compile { target c++23 } } // operators that are not required to be members // called in a non-dependent context // see header #include "explicit-obj-ops-non-mem.h" // noop, indicates which versions are ill-formed // I could not find a way to test the invalid cases // without requires expressions #define TEST_INVALID(X) void do_calls() { Value value{}; TEST_OPS(value) TEST_OPS(static_cast(value)) TEST_OPS(static_cast(value)) TEST_OPS(static_cast(value)) LRef l_ref{}; TEST_OPS(l_ref) TEST_INVALID(static_cast(l_ref)) TEST_INVALID(static_cast(l_ref)) TEST_INVALID(static_cast(l_ref)) RRef r_ref{}; TEST_INVALID(r_ref) TEST_OPS(static_cast(r_ref)) TEST_INVALID(static_cast(r_ref)) TEST_INVALID(static_cast(r_ref)) ConstLRef const_l_ref{}; TEST_OPS(const_l_ref) TEST_OPS(static_cast(const_l_ref)) TEST_OPS(static_cast(const_l_ref)) TEST_OPS(static_cast(const_l_ref)) ConstRRef const_r_ref{}; TEST_INVALID(const_r_ref) TEST_OPS(static_cast(const_r_ref)) TEST_INVALID(static_cast(const_r_ref)) TEST_OPS(static_cast(const_r_ref)) Deduced deduced{}; TEST_OPS(deduced) TEST_OPS(static_cast(deduced)) TEST_OPS(static_cast(deduced)) TEST_OPS(static_cast(deduced)) VALIDATE_RETURN_TYPES(deduced, Deduced&) VALIDATE_RETURN_TYPES(static_cast(deduced), Deduced&&) VALIDATE_RETURN_TYPES(static_cast(deduced), Deduced const&) VALIDATE_RETURN_TYPES(static_cast(deduced), Deduced const&&) }