diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h index c8df624dfa23d6..0df7ead28cd340 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/Interp/Interp.h @@ -993,17 +993,13 @@ inline bool ExpandPtr(InterpState &S, CodePtr OpPC) { // Read opcode arguments //===----------------------------------------------------------------------===// -template -inline std::enable_if_t::value, T> ReadArg(InterpState &S, - CodePtr &OpPC) { - return OpPC.read(); -} - -template -inline std::enable_if_t::value, T> ReadArg(InterpState &S, - CodePtr &OpPC) { - uint32_t ID = OpPC.read(); - return reinterpret_cast(S.P.getNativePointer(ID)); +template inline T ReadArg(InterpState &S, CodePtr &OpPC) { + if constexpr (std::is_pointer::value) { + uint32_t ID = OpPC.read(); + return reinterpret_cast(S.P.getNativePointer(ID)); + } else { + return OpPC.read(); + } } /// Interpreter entry point.