include/o3tl/underlying_type.hxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
New commits: commit 7ad4e562b462af22a1c29c955293238cdb30267b Author: Christoph Lutz <christoph.lutz...@cib.de> Date: Thu May 7 13:47:35 2015 +0200 improve fallback behaviour of underlying_type for old gcc The fix fbd85c25b is not sufficient to build with an old GCC 4.6. The problem was, that underlying_type returned an int as default value for GCC 4.6 and int allows negative values that are forbidden in typed_flags_set. Changed it to alternative solution suggested in http://stackoverflow.com/questions/26148192/underlying-type-of-a-c-enum-in-c03 Change-Id: I20f44b8cef9c692efb583971bd251f1c34c289ab Reviewed-on: https://gerrit.libreoffice.org/15663 Reviewed-by: Katarina Behrens <katarina.behr...@cib.de> Tested-by: Katarina Behrens <katarina.behr...@cib.de> diff --git a/include/o3tl/underlying_type.hxx b/include/o3tl/underlying_type.hxx index 4b2e077..534e088 100644 --- a/include/o3tl/underlying_type.hxx +++ b/include/o3tl/underlying_type.hxx @@ -19,7 +19,11 @@ namespace o3tl { template<typename T> struct underlying_type { #if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ <= 6 && \ !defined __clang__ - typedef int type; + typedef typename std::conditional< + T( -1 ) < T( 0 ), + typename std::make_signed< T >::type, + typename std::make_unsigned< T >::type + >::type type; #else typedef typename std::underlying_type<T>::type type; #endif _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits