Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2007-01-17 05:41:32


Thomas Witt wrote:
> Hi,
>
> On Jan 16, 2007, at 2:03 PM, Tobias Schwinger wrote:
>
>> Doug Gregor wrote:
>>
>>> Are we talking about a showstopper?
>> No (not for me, at least).
>>
>> It might not be too good of an idea to release with a bug in that
>> basic of a component (and even a standardized one), still.
>
> I've to admit that I am still in the dark as to how serious the
> problem is

Using a pointer to a member function without parameters (except "this")
with result_of causes a compile error.

The problem obviously doesn't break any of our existing tests, but
possibly non-existing ones.

Four Boost libraries currently #include result_of.hpp: Parameter,
PtrContainer, XPressive (HEAD only), and TR1 ('using boost::result_of').

> and what the patch for 1.34 would be.

See attached files.

Note that it might be overly careful (I don't have the Metrowerks
compiler to verify whether repeating that Workaround is really needed).
If it isn't needed, the first line changed by that patch (>= 1 instead
of > 1) will be sufficient.

>
> Any clarification would be appreciated.
>

HTH

Regards,
Tobias

Index: libs/utility/test/result_of_test.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/utility/test/result_of_test.cpp,v
retrieving revision 1.2
diff -u -r1.2 result_of_test.cpp
--- libs/utility/test/result_of_test.cpp 25 Jul 2004 03:57:20 -0000 1.2
+++ libs/utility/test/result_of_test.cpp 14 Jan 2007 00:07:34 -0000
@@ -33,6 +33,7 @@
   typedef int (*func_ptr)(float, double);
   typedef int (&func_ref)(float, double);
   typedef int (X::*mem_func_ptr)(float);
+ typedef int (X::*mem_func_ptr_0)();
   typedef int (X::*mem_func_ptr_c)(float) const;
   typedef int (X::*mem_func_ptr_v)(float) volatile;
   typedef int (X::*mem_func_ptr_cv)(float) const volatile;
@@ -46,6 +47,7 @@
   BOOST_STATIC_ASSERT((is_same<result_of<func_ptr(char, float)>::type, int>::value));
   BOOST_STATIC_ASSERT((is_same<result_of<func_ref(char, float)>::type, int>::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_0(X)>::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));
   BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_cv(X,char)>::type, int>::value));

Index: boost/utility/detail/result_of_iterate.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/utility/detail/result_of_iterate.hpp,v
retrieving revision 1.2
diff -u -r1.2 result_of_iterate.hpp
--- boost/utility/detail/result_of_iterate.hpp 10 Aug 2004 13:57:30 -0000 1.2
+++ boost/utility/detail/result_of_iterate.hpp 17 Jan 2007 09:28:47 -0000
@@ -42,45 +42,46 @@
 
 #undef BOOST_RESULT_OF_ARGS
 
-#if BOOST_PP_ITERATION() > 1 && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+#if BOOST_PP_ITERATION() >= 1 && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+
+// CWPro8 requires an argument in a function type specialization
+#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 1
+# define BOOST_RESULT_OF_ARGS void
+#else
+# define BOOST_RESULT_OF_ARGS \
+ BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)
+#endif
+
 template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of<R (T0::*)
- (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)),
- FArgs>
+struct result_of<R (T0::*)(BOOST_RESULT_OF_ARGS),FArgs>
 {
   typedef R type;
 };
 
 template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of<R (T0::*)
- (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
- const,
- FArgs>
+struct result_of<R (T0::*)(BOOST_RESULT_OF_ARGS) const, FArgs>
 {
   typedef R type;
 };
 
 template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of<R (T0::*)
- (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
- volatile,
- FArgs>
+struct result_of<R (T0::*)(BOOST_RESULT_OF_ARGS) volatile, FArgs>
 {
   typedef R type;
 };
 
 template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of<R (T0::*)
- (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
- const volatile,
- FArgs>
+struct result_of<R (T0::*)(BOOST_RESULT_OF_ARGS) const volatile, FArgs>
 {
   typedef R type;
 };
+
+#undef BOOST_RESULT_OF_ARGS
+
 #endif
 
 }


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk