Bläddra i källkod

Fix bug with Clang where wrapped function pointers are optimized out

Ole 10 år sedan
förälder
incheckning
1fb8e0391e
1 ändrade filer med 4 tillägg och 5 borttagningar
  1. 4 5
      lib/luwra/functions.hpp

+ 4 - 5
lib/luwra/functions.hpp

@@ -70,10 +70,6 @@ namespace internal {
 	template <typename R, typename... A>
 	template <typename R, typename... A>
 	struct FunctionWrapperHelper<R(*)(A...)> {
 	struct FunctionWrapperHelper<R(*)(A...)> {
 		using Signature = R(A...);
 		using Signature = R(A...);
-
-		template <R(*function_pointer)(A...)> static
-		constexpr CFunction wrapped =
-			&internal::FunctionWrapper<Signature>::template invoke<function_pointer>;
 	};
 	};
 }
 }
 
 
@@ -101,7 +97,10 @@ constexpr CFunction wrap_function =
  * This macros allows you to wrap functions without providing a type signature.
  * This macros allows you to wrap functions without providing a type signature.
  */
  */
 #define LUWRA_WRAP_FUNCTION(fun) \
 #define LUWRA_WRAP_FUNCTION(fun) \
-	(luwra::internal::FunctionWrapperHelper<decltype(&fun)>::wrapped<&fun>)
+	(luwra::wrap_function< \
+	     typename luwra::internal::FunctionWrapperHelper<decltype(&fun)>::Signature, \
+	     &fun \
+	 >)
 
 
 LUWRA_NS_END
 LUWRA_NS_END