From 4a45d035449e3042507e4448ef314aaff5faeb13 Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 7 Jun 2015 18:30:28 +0100 Subject: [PATCH] gcc warning fixes --- octa/functional.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/octa/functional.h b/octa/functional.h index 4c49920..ce0aba8 100644 --- a/octa/functional.h +++ b/octa/functional.h @@ -366,11 +366,21 @@ namespace detail { template A &get_alloc() { - return (A &)manager; + union { + const FunctionManager **m; + A *alloc; + } u; + u.m = &manager; + return *u.alloc; } template const A &get_alloc() const { - return (const A &)manager; + union { + const FunctionManager * const *m; + const A *alloc; + } u; + u.m = &manager; + return *u.alloc; } }; @@ -394,7 +404,12 @@ namespace detail { } static T &get_ref(const FmStorage &s) { - return (T &)(s.data); + union { + const FunctorData *data; + T *ret; + } u; + u.data = &s.data; + return *u.ret; } }; @@ -741,7 +756,7 @@ namespace detail { template struct DcLambdaTypes { - typedef R (*Ptr)(A...); + typedef octa::Function Ptr; typedef octa::Function Obj; };