diff --git a/include/swift/Driver/Compilation.h b/include/swift/Driver/Compilation.h index 7c94454d401d6..89fd54813d5e6 100644 --- a/include/swift/Driver/Compilation.h +++ b/include/swift/Driver/Compilation.h @@ -92,7 +92,7 @@ class Compilation { Result(bool hadAbnormalExit, int exitCode, fine_grained_dependencies::ModuleDepGraph depGraph) : hadAbnormalExit(hadAbnormalExit), exitCode(exitCode), - depGraph(depGraph) {} + depGraph(std::move(depGraph)) {} Result(const Result &) = delete; Result &operator=(const Result &) = delete; diff --git a/include/swift/SIL/SILValue.h b/include/swift/SIL/SILValue.h index 7a3b34690a2c0..423aa300d888e 100644 --- a/include/swift/SIL/SILValue.h +++ b/include/swift/SIL/SILValue.h @@ -271,6 +271,17 @@ struct ValueOwnershipKind { explicit operator bool() const { return value != OwnershipKind::Any; } +#ifndef __cpp_impl_three_way_comparison + // C++20 (more precisely P1185) introduced more overload candidates for + // comparison operator calls. With that in place the following definitions are + // redundant and actually cause compilation errors because of ambiguity. + // P1630 explains the rationale behind introducing this backward + // incompatibility. + // + // References: + // https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1185r2.html + // https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1630r1.html + bool operator==(ValueOwnershipKind other) const { return value == other.value; } @@ -280,6 +291,7 @@ struct ValueOwnershipKind { bool operator==(innerty other) const { return value == other; } bool operator!=(innerty other) const { return !(value == other); } +#endif /// We merge by moving down the lattice. ValueOwnershipKind merge(ValueOwnershipKind rhs) const {