Module: Mesa Branch: master Commit: 149a036825ba74f9edd2468430f99ec0e927b845 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=149a036825ba74f9edd2468430f99ec0e927b845
Author: Jesse Natalie <[email protected]> Date: Wed Nov 18 18:32:27 2020 -0800 clover: Fix property_element::as for MSVC MSVC doesn't like reinterpret_cast<T>(val) where neither T nor val are pointers. It needs to be a static cast instead. v2: Update assert to static_assert Reviewed-by: Francisco Jerez <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680> --- src/gallium/frontends/clover/core/property.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/clover/core/property.hpp b/src/gallium/frontends/clover/core/property.hpp index 7f8e17684d9..518f10dcaf9 100644 --- a/src/gallium/frontends/clover/core/property.hpp +++ b/src/gallium/frontends/clover/core/property.hpp @@ -199,12 +199,18 @@ namespace clover { } template<typename S> - S + typename std::enable_if<!std::is_convertible<T, S>::value, S>::type as() const { - assert(sizeof(S) <= sizeof(T)); + static_assert(sizeof(S) <= sizeof(T), "Ensure type fits in property list"); return reinterpret_cast<S>(x); } + template<typename S> + typename std::enable_if<std::is_convertible<T, S>::value, S>::type + as() const { + return static_cast<S>(x); + } + private: T x; }; _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
