From 69d2a4148d67342ae6ed0728a771453c3d4f3657 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 28 Jan 2016 21:21:41 +0100 Subject: [PATCH] tuple initialisation from GenNode: disallow any numerical conversion from LUID since this is a quick-n-dirty workariound, until we're using GCC-5, I'll err for the simple and safe side and disallow any conversion from LuidH do some algebraic data type. The problem arises, sincd LuidH defines a conversion to size_t, which depends on the platform. So, without checking the actual NumericLimits, there is no way we can allow a conversion to size_t in a hard wired way, while disallowing a narrowing conversion to 32bit unsigned int on 64bit platforms. And in the end, we don't want conversions from LUID to numeric values to happen automatically anyway. But of course we *do* want automatic promotion from a LuidH to a PlacementRef... --- src/lib/meta/trait.hpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/lib/meta/trait.hpp b/src/lib/meta/trait.hpp index 2f25bd4eb..a12055522 100644 --- a/src/lib/meta/trait.hpp +++ b/src/lib/meta/trait.hpp @@ -351,6 +351,13 @@ namespace meta { > { }; + template + struct is_narrowingInit + : __or_ + ,is_floating_point + > + { }; + #define TRAIT_IS_NARROWING(_SRC_, _TAR_) \ template<> \ struct is_narrowingInit<_SRC_, _TAR_> \ @@ -376,16 +383,6 @@ namespace meta { TRAIT_IS_NARROWING (double, float) - TRAIT_IS_NARROWING (lib::hash::LuidH, int64_t) - TRAIT_IS_NARROWING (lib::hash::LuidH, int32_t) - TRAIT_IS_NARROWING (lib::hash::LuidH, int16_t) - TRAIT_IS_NARROWING (lib::hash::LuidH, int8_t) - TRAIT_IS_NARROWING (lib::hash::LuidH, char) - TRAIT_IS_NARROWING (lib::hash::LuidH, uint16_t) - TRAIT_IS_NARROWING (lib::hash::LuidH, uint8_t) - TRAIT_IS_NARROWING (lib::hash::LuidH, double) - TRAIT_IS_NARROWING (lib::hash::LuidH, float) - #undef TRAIT_IS_NARROWING