Opened 10 years ago
Closed 5 years ago
#8452 closed Bugs (invalid)
Conflict between Boost.Format and filtered_graph in Boost.Graph
Reported by: | Owned by: | Samuel Krempp | |
---|---|---|---|
Milestone: | To Be Determined | Component: | format |
Version: | Boost 1.53.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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.
Change History (3)
comment:1 by , 10 years ago
Component: | None → format |
---|---|
Owner: | set to |
comment:3 by , 5 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Sample code showing this failure is required as the explanation is complex.
Would it make sense to just add a namespace qualification (
boost::io::detail
, most likely) to the call toput
? Or does that need to use ADL, even with the explicit template arguments?