diff --git a/oneflow/core/common/decorator.h b/oneflow/core/common/decorator.h index 751a23adb3f..5505559606d 100644 --- a/oneflow/core/common/decorator.h +++ b/oneflow/core/common/decorator.h @@ -30,15 +30,14 @@ struct WithDecorator final { template struct Decorate final { template - struct FuncPtr final { - static constexpr T (*value)(Args...) = &Decorator::template Call; - }; + static T Call(Args... args) { + return Decorator::template Call(args...); + } }; }; #define DECORATE(fn_ptr, decorator) \ - static_cast( \ - WithDecorator::Decorate::FuncPtr::value) + (&WithDecorator::Decorate::Call) template struct ThreadLocalCopiable;