diff --git a/llvm/include/llvm/ADT/FunctionExtras.h b/llvm/include/llvm/ADT/FunctionExtras.h index e45d507bfd4bf..1311452a17bb3 100644 --- a/llvm/include/llvm/ADT/FunctionExtras.h +++ b/llvm/include/llvm/ADT/FunctionExtras.h @@ -231,7 +231,6 @@ template class UniqueFunctionBase { // The pointers to call/move/destroy functions are determined for each // callable type (and called-as type, which determines the overload chosen). - // (definitions are out-of-line). // By default, we need an object that contains all the different // type erased behaviors needed. Create a static instance of the struct type @@ -239,14 +238,15 @@ template class UniqueFunctionBase { // Wrap in a struct to avoid https://gcc.gnu.org/PR71954 template struct CallbacksHolder { - static NonTrivialCallbacks Callbacks; + inline static NonTrivialCallbacks Callbacks = { + &CallImpl, &MoveImpl, &DestroyImpl}; }; // See if we can create a trivial callback. We need the callable to be // trivially moved and trivially destroyed so that we don't have to store // type erased callbacks for those operations. template struct CallbacksHolder> { - static TrivialCallback Callbacks; + inline static TrivialCallback Callbacks = {&CallImpl}; }; // A simple tag type so the call-as type to be passed to the constructor. @@ -344,19 +344,6 @@ template class UniqueFunctionBase { } }; -template -template -typename UniqueFunctionBase::NonTrivialCallbacks UniqueFunctionBase< - R, P...>::CallbacksHolder::Callbacks = { - &CallImpl, &MoveImpl, &DestroyImpl}; - -template -template -typename UniqueFunctionBase::TrivialCallback - UniqueFunctionBase::CallbacksHolder< - CallableT, CalledAsT, EnableIfTrivial>::Callbacks{ - &CallImpl}; - } // namespace detail template