diff --git a/aten/src/ATen/core/dispatch/KernelRegistration.h b/aten/src/ATen/core/dispatch/KernelRegistration.h index eaab0c15e02677..4fef909bc04f39 100644 --- a/aten/src/ATen/core/dispatch/KernelRegistration.h +++ b/aten/src/ATen/core/dispatch/KernelRegistration.h @@ -228,7 +228,7 @@ class KernelRegistrationBuilder final { * @param dispatch_key dispatch key to register the function to * @return "this" for method chaining */ - constexpr KernelRegistrationBuilder dispatchKey(TensorTypeId dispatch_key) && { + AT_CPP14_CONSTEXPR KernelRegistrationBuilder dispatchKey(TensorTypeId dispatch_key) && { static_assert(!(FieldsPresentFlags & DISPATCH_KEY_PRESENT), "Tried to define kernel twice in same op registration"); return KernelRegistrationBuilder(std::move(op_), std::move(dispatch_key), kernel_, cache_creator_); } @@ -239,7 +239,7 @@ class KernelRegistrationBuilder final { * @return "this" for method chaining */ template - constexpr KernelRegistrationBuilder kernel() && { + AT_CPP14_CONSTEXPR KernelRegistrationBuilder kernel() && { static_assert(!(FieldsPresentFlags & KERNEL_PRESENT), "Tried to define kernel twice in same op registration"); // TODO Better error message when kernel function mismatches, one common mismatch is missing cache parameter or cache parameter present while not expected. return KernelRegistrationBuilder(std::move(op_), std::move(dispatch_key_), kernel_func, cache_creator_); @@ -251,7 +251,7 @@ class KernelRegistrationBuilder final { * @return "this" for method chaining */ template - constexpr KernelRegistrationBuilder kernel() && { + AT_CPP14_CONSTEXPR KernelRegistrationBuilder kernel() && { // TODO Better error message if FuncType is not a func type return std::move(*this).template kernel<&detail::wrap_kernel::call>(); } @@ -262,7 +262,7 @@ class KernelRegistrationBuilder final { * @return "this" for method chaining */ template - constexpr KernelRegistrationBuilder withCache() && { + AT_CPP14_CONSTEXPR KernelRegistrationBuilder withCache() && { static_assert(!(FieldsPresentFlags & CACHE_PRESENT), "Tried to define cache twice in same op registration"); static_assert(std::is_base_of::value, "Cache must inherit from c10::KernelCache");