From 14919f49ec1b4862a50d84ebf43b5e3c5db1596d Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 3 Dec 2018 23:39:03 +0100 Subject: [PATCH] - gcc/clang didn't like having this in a class --- src/scripting/vm/vm.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/scripting/vm/vm.h b/src/scripting/vm/vm.h index e451cb80c..4f6b23bc5 100644 --- a/src/scripting/vm/vm.h +++ b/src/scripting/vm/vm.h @@ -561,6 +561,19 @@ struct FieldDesc int BitValue; }; +namespace +{ + // Traits for the types we are interested in + template struct native_is_valid { static const bool value = false; }; + template struct native_is_valid { static const bool value = true; }; + template struct native_is_valid { static const bool value = true; }; + template<> struct native_is_valid { static const bool value = true; }; + template<> struct native_is_valid { static const bool value = true; }; + template<> struct native_is_valid { static const bool value = true; }; + template<> struct native_is_valid { static const bool value = true; }; + template<> struct native_is_valid { static const bool value = true; }; +} + // Compile time validation of direct native functions struct DirectNativeDesc { @@ -582,17 +595,7 @@ struct DirectNativeDesc #undef TP #undef VP - template void ValidateType() { static_assert(is_valid::value, "Argument type is not valid as a direct native parameter or return type"); } - - // Traits for the types we are interested in - template struct is_valid { static const bool value = false; }; - template struct is_valid { static const bool value = true; }; - template struct is_valid { static const bool value = true; }; - template<> struct is_valid { static const bool value = true; }; - template<> struct is_valid { static const bool value = true; }; - template<> struct is_valid { static const bool value = true; }; - template<> struct is_valid { static const bool value = true; }; - template<> struct is_valid { static const bool value = true; }; + template void ValidateType() { static_assert(native_is_valid::value, "Argument type is not valid as a direct native parameter or return type"); } operator void *() const { return Ptr; }