[Boost-bugs] [Boost C++ Libraries] #8452: Conflict between Boost.Format and filtered_graph in Boost.Graph

Subject: [Boost-bugs] [Boost C++ Libraries] #8452: Conflict between Boost.Format and filtered_graph in Boost.Graph
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-17 12:52:04


#8452: Conflict between Boost.Format and filtered_graph in Boost.Graph
-------------------------------------+--------------------------------------
 Reporter: Jan Hudec <bulb@…> | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.53.0
 Severity: Problem | Keywords:
-------------------------------------+--------------------------------------
 I am using `boost::format` in my logging macros and some graphs from
 Boost.Graph. But whenever I include `boost/graph/filtered_graph.hpp`, GCC
 starts to complain that

 {{{
 boost/graph/graph_traits.hpp: In instantiation of 'struct
 boost::graph_traits<char>':
 boost/graph/filtered_graph.hpp:131:57: required from 'struct
 boost::filtered_graph_base<char>'
 boost/graph/filtered_graph.hpp:141:9: required from 'class
 boost::filtered_graph<char, std::char_traits<char>, std::allocator<char>
>'
 boost/format/feed_args.hpp:253:17: required from 'void
 boost::io::detail::distribute(boost::basic_format<Ch, Tr, Alloc>&, T)
 [with Ch = char; Tr = std::char_traits<char>; Alloc =
 std::allocator<char>; T = const SomeWrapper<lots of boost::graph things
 here> &]'
 boost/format/feed_args.hpp:263:9: required from 'boost::basic_format<Ch,
 Tr, Alloc>& boost::io::detail::feed(boost::basic_format<Ch, Tr, Alloc>&,
 T) [with Ch = char; Tr = std::char_traits<char>; Alloc =
 std::allocator<char>; T = const SomeWrapper<lots of boost::graph things
 here> &]'
 [... more required froms, don't seem relevant anymore ...]
 boost/graph/graph_traits.hpp:33:52: error: 'char' is not a class, struct,
 or union type
 }}}

 The `SomeWrapper` is my class for customizing `operator<<`. It's template
 argument has few hundred characters. It is pair of iterators into
 something
 complex involving `boost::directed_graph`. The `filtered_graph` is not
 actually
 used, only included.

 Both GCC 4.5.2 and 4.7.2 show the above error, but Visual C++
 15.00.30729.01
 (Visual Studio 9 2008) compiles it just fine. I am not sure whether it is
 bug
 in GCC or whether MSVC considers SFINAE something that isn't, but it seems
 to
 be the later. The template from `boost/graph/filtered_graph.hpp` will be
 found
 by ADL and because the template parameters are provided explicitly,
 compiler
 must instantiate it to find out whether it is better candidate or not.
 That
 fails, but not in immediate context, so it is not SFINAE.

 It can be worked around by qualifying the `put` in
 `boost/format/feed_args.hpp`,
 renaming it, or by modifying the templates in graph_traits and
 filtered_graph
 to make the failure SFINAE (might have some advantages elsewhere).

 I had the problem with 1.51 and updated to 1.53, because there are some
 changes
 to `graph_traits` that looked like they may be relevant, but it didn't
 help.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8452>
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:12 UTC