Subject: [Boost-bugs] [Boost C++ Libraries] #6555: output_test_stream does not play nicely with std::ref() (GCC 4.6.1, C++2011 mode)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-13 23:15:06
#6555: output_test_stream does not play nicely with std::ref() (GCC 4.6.1, C++2011
mode)
------------------------------+---------------------------------------------
Reporter: greenc@⦠| Owner: rogeeff
Type: Bugs | Status: new
Milestone: To Be Determined | Component: test
Version: Boost 1.48.0 | Severity: Problem
Keywords: C++2011 |
------------------------------+---------------------------------------------
Under GCC 4.6.1 with Boost 1.48.0 and C++2011 turned on (as it was for the
compile of Boost), the following code fails to compile (with appropriate
wrapping):
{{{#!C++
boost::test_tools::output_test_stream os;
(void) std::ref(os);
}}}
The relevant part of the error message is (I believe):
{{{
.../include/boost/test/output_test_stream.hpp:42:37: error: 'typedef class
boost::test_tools::predicate_result
boost::test_tools::output_test_stream::result_type' is private
.../bin/../lib/gcc/x86_64-unknown-linux-
gnu/4.6.1/../../../../include/c++/4.6.1/functional:74:46: error: within
this context
}}}
It seems that the GCC `std::ref()` function is trying to pick out a nested
`result_type` if defined in order to ascertain whether
`output_test_stream` is callable. Unfortunately `result_type` is defined
but private, which causes a compile error in the template code.
Solutions:
(1) Use `predicate_result` directly instead of using a typedef at all.
(2) Make the typedef public (may cause problems based on what `std::ref()`
does next when it '''does''' think output_test_stream is callable).
(3) Call it something other than `result_type`.
Thanks for your help.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6555> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC