Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80656 - in trunk: boost/utility boost/utility/detail libs/utility/test
From: eric_at_[hidden]
Date: 2012-09-22 22:08:33


Author: eric_niebler
Date: 2012-09-22 22:08:32 EDT (Sat, 22 Sep 2012)
New Revision: 80656
URL: http://svn.boost.org/trac/boost/changeset/80656

Log:
nicer work-around for gcc warnings
Text files modified:
   trunk/boost/utility/detail/result_of_iterate.hpp | 8 +-------
   trunk/boost/utility/result_of.hpp | 15 ++++++++-------
   trunk/libs/utility/test/result_of_test.cpp | 12 ++++++++++++
   3 files changed, 21 insertions(+), 14 deletions(-)

Modified: trunk/boost/utility/detail/result_of_iterate.hpp
==============================================================================
--- trunk/boost/utility/detail/result_of_iterate.hpp (original)
+++ trunk/boost/utility/detail/result_of_iterate.hpp 2012-09-22 22:08:32 EDT (Sat, 22 Sep 2012)
@@ -15,12 +15,6 @@
 # error Boost result_of - do not include this file!
 #endif
 
-// This header generate spurious warnings on gcc, which we supress by
-// treating it as a system header.
-#if defined(__GNUC__) && (__GNUC__ >= 4)
-#pragma GCC system_header
-#endif
-
 // CWPro8 requires an argument in a function type specialization
 #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0
 # define BOOST_RESULT_OF_ARGS void
@@ -101,7 +95,7 @@
     typedef typename BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())<F>::type wrapper_t;
     static const bool value = (
         sizeof(result_of_no_type) == sizeof(detail::result_of_is_private_type(
- (boost::declval<wrapper_t>()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)), 0)
+ (boost::declval<wrapper_t>()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)), result_of_weird_type())
         ))
     );
     typedef mpl::bool_<value> type;

Modified: trunk/boost/utility/result_of.hpp
==============================================================================
--- trunk/boost/utility/result_of.hpp (original)
+++ trunk/boost/utility/result_of.hpp 2012-09-22 22:08:32 EDT (Sat, 22 Sep 2012)
@@ -74,18 +74,19 @@
 
 template<typename T> T result_of_decay(T);
 
-struct result_of_private_type
-{
- result_of_private_type const &operator,(int) const;
+struct result_of_private_type {};
+
+struct result_of_weird_type {
+ template<typename T>
+ friend result_of_weird_type operator,(T const &, result_of_weird_type);
+ friend result_of_private_type operator,(result_of_private_type, result_of_weird_type);
 };
 
 typedef char result_of_yes_type; // sizeof(result_of_yes_type) == 1
 typedef char (&result_of_no_type)[2]; // sizeof(result_of_no_type) == 2
 
-template<typename T>
-result_of_no_type result_of_is_private_type(T const &);
-
-result_of_yes_type result_of_is_private_type(result_of_private_type const &);
+result_of_no_type result_of_is_private_type(result_of_weird_type);
+result_of_yes_type result_of_is_private_type(result_of_private_type);
 
 template<typename C>
 struct result_of_callable_class : C {

Modified: trunk/libs/utility/test/result_of_test.cpp
==============================================================================
--- trunk/libs/utility/test/result_of_test.cpp (original)
+++ trunk/libs/utility/test/result_of_test.cpp 2012-09-22 22:08:32 EDT (Sat, 22 Sep 2012)
@@ -160,6 +160,10 @@
   typedef int (&func_ref)(float, double);
   typedef int (*func_ptr_0)();
   typedef int (&func_ref_0)();
+ typedef void (*func_ptr_void)(float, double);
+ typedef void (&func_ref_void)(float, double);
+ typedef void (*func_ptr_void_0)();
+ typedef void (&func_ref_void_0)();
   typedef int (X::*mem_func_ptr)(float);
   typedef int (X::*mem_func_ptr_c)(float) const;
   typedef int (X::*mem_func_ptr_v)(float) volatile;
@@ -218,6 +222,10 @@
   BOOST_STATIC_ASSERT((is_same<result_of<func_ref(char, float)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<func_ptr_0()>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<func_ref_0()>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<func_ptr_void(char, float)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<func_ref_void(char, float)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<func_ptr_void_0()>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<result_of<func_ref_void_0()>::type, void>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr(X,char)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_c(X,char)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_v(X,char)>::type, int>::value));
@@ -228,6 +236,10 @@
   BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref(char, float)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr_0()>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref_0()>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr_void(char, float)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref_void(char, float)>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ptr_void_0()>::type, void>::value));
+ BOOST_STATIC_ASSERT((is_same<tr1_result_of<func_ref_void_0()>::type, void>::value));
   BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr(X,char)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_c(X,char)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<tr1_result_of<mem_func_ptr_v(X,char)>::type, int>::value));


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk