diff --git a/common/map_test.cpp b/common/map_test.cpp index fcee5e0f734c..d74645f0f320 100644 --- a/common/map_test.cpp +++ b/common/map_test.cpp @@ -17,7 +17,7 @@ // Workaround for std::pair comparison deficiency in libc++ 16. #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 170000 namespace std { -template +template requires(convertible_to && convertible_to) inline auto operator==( pair, std::reference_wrapper> lhs, diff --git a/toolchain/base/kind_switch.h b/toolchain/base/kind_switch.h index 54d8406e4696..4db4c05e9b77 100644 --- a/toolchain/base/kind_switch.h +++ b/toolchain/base/kind_switch.h @@ -78,12 +78,12 @@ concept IsStdVariant = IsStdVariantValue>; // Used to provide a reason in the compiler error from `ValidCaseType`, which // will state that "T does not satisfy TypeFoundInVariant". -template +template concept TypeFoundInVariant = false; // Used to cause a compler error, which will state that "ValidCaseType was not // satisfied" for T and std::variant<...>. -template +template requires TypeFoundInVariant struct ValidCaseType; diff --git a/toolchain/check/diagnostic_helpers.h b/toolchain/check/diagnostic_helpers.h index de3f6d7dcdd7..29509ee138e8 100644 --- a/toolchain/check/diagnostic_helpers.h +++ b/toolchain/check/diagnostic_helpers.h @@ -26,7 +26,7 @@ class LocIdForDiagnostics { return LocIdForDiagnostics(SemIR::LocId(node_id), true); } - template + template requires std::constructible_from // NOLINTNEXTLINE(google-explicit-constructor) LocIdForDiagnostics(LocT loc_id) diff --git a/toolchain/sem_ir/ids.h b/toolchain/sem_ir/ids.h index fa41fc66e188..63f3bfe378cd 100644 --- a/toolchain/sem_ir/ids.h +++ b/toolchain/sem_ir/ids.h @@ -65,7 +65,7 @@ constexpr TypeInstId TypeInstId::None = TypeInstId::UnsafeMake(InstId::None); // Unlike TypeInstId, this type can *not* be an operand in instructions, since // being a template prevents it from being used in non-generic contexts such as // switches. -template +template struct KnownInstId : public InstId { static const KnownInstId None; @@ -81,7 +81,7 @@ struct KnownInstId : public InstId { : InstId(id) {} }; -template +template constexpr KnownInstId KnownInstId::None = KnownInstId::UnsafeMake(InstId::None); diff --git a/toolchain/sem_ir/inst.h b/toolchain/sem_ir/inst.h index 6e0f50e25a72..a0d0bde952e8 100644 --- a/toolchain/sem_ir/inst.h +++ b/toolchain/sem_ir/inst.h @@ -522,7 +522,7 @@ class InstStore { return TryGetAs(inst_id); } - template + template struct GetAsWithIdResult { KnownInstId inst_id; InstT inst; diff --git a/toolchain/sem_ir/type_iterator.h b/toolchain/sem_ir/type_iterator.h index 384afd7358f2..f788d9f80866 100644 --- a/toolchain/sem_ir/type_iterator.h +++ b/toolchain/sem_ir/type_iterator.h @@ -198,7 +198,7 @@ class TypeIterator::Step { ClassStart, StructStart, TupleStart, InterfaceStart, IntStart, ArrayStart, PointerStart, End, Done, Error>; - template + template auto Is() const -> bool { return std::holds_alternative(any); } @@ -208,7 +208,7 @@ class TypeIterator::Step { // This is a template to allow implicit conversion directly from step values // that can go inside `Any` to `Step` (without having to make the `Any` // explicitly first). - template + template requires std::constructible_from // NOLINTNEXTLINE(google-explicit-constructor) Step(T any) : any(any) {}