Opened 5 years ago

#13404 new Bugs

boost::container::container_detail::forward_as_tuple conflicts with std::forward_as_tuple

Reported by: Mikhail Kremniov <mkremniov@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.66.0 Severity: Problem
Keywords: Cc:

Description

Internals of libc++ make unqualified calls to forward_as_tuple; this may result in the "call ... is ambiguous" error if boost::container::container_detail is one of the associated namespaces for the call.

E.g. test.cpp:

#include <boost/container/set.hpp>
#include <tuple>

int main()
{
    boost::container::set<int> set;
    
    std::tuple_cat(std::make_tuple(set));
}

The terminal:

$ clang++-5.0 ~/tmp/test.cpp -std=c++14 -o test -stdlib=libc++ -isystem ./boost_1_66_0
In file included from /home/brd/tmp/test.cpp:1:
In file included from ./boost_1_66_0/boost/container/set.hpp:28:
In file included from ./boost_1_66_0/boost/container/detail/tree.hpp:36:
In file included from ./boost_1_66_0/boost/container/detail/node_alloc_holder.hpp:30:
In file included from ./boost_1_66_0/boost/container/detail/allocator_version_traits.hpp:26:
In file included from ./boost_1_66_0/boost/container/throw_exception.hpp:27:
In file included from /home/brd/soft/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/../include/c++/v1/string:470:
In file included from /home/brd/soft/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/../include/c++/v1/string_view:169:
In file included from /home/brd/soft/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/../include/c++/v1/__string:56:
In file included from /home/brd/soft/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/../include/c++/v1/algorithm:643:
In file included from /home/brd/soft/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/../include/c++/v1/memory:653:
/home/brd/soft/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/../include/c++/v1/tuple:1318:16: error: call to 'forward_as_tuple' is ambiguous
        return forward_as_tuple(_VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,
               ^~~~~~~~~~~~~~~~
/home/brd/soft/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/../include/c++/v1/tuple:1348:12: note: in instantiation of function template specialization 'std::__1::__tuple_cat<std::__1::tuple<>, std::__1::__tuple_indices<>,
      std::__1::__tuple_indices<0> >::operator()<std::__1::tuple<boost::container::set<int, std::__1::less<int>, boost::container::new_allocator<int>, boost::container::tree_opt<boost::container::tree_type_enum::red_black_tree, true> > >
      >' requested here
    return __tuple_cat<tuple<>, __tuple_indices<>,
           ^
/home/brd/tmp/test.cpp:8:10: note: in instantiation of function template specialization 'std::__1::tuple_cat<std::__1::tuple<boost::container::set<int, std::__1::less<int>, boost::container::new_allocator<int>,
      boost::container::tree_opt<boost::container::tree_type_enum::red_black_tree, true> > >>' requested here
    std::tuple_cat(std::make_tuple(set));
         ^
./boost_1_66_0/boost/container/detail/variadic_templates_tools.hpp:81:20: note: candidate function [with Values = <boost::container::set<int, std::__1::less<int>, boost::container::new_allocator<int>,
      boost::container::tree_opt<boost::container::tree_type_enum::red_black_tree, true> >>]
tuple<Values&&...> forward_as_tuple(Values&&... values)
                   ^
/home/brd/soft/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/../include/c++/v1/tuple:1114:1: note: candidate function [with _Tp = <boost::container::set<int, std::__1::less<int>, boost::container::new_allocator<int>,
      boost::container::tree_opt<boost::container::tree_type_enum::red_black_tree, true> >>]
forward_as_tuple(_Tp&&... __t) _NOEXCEPT
^
1 error generated.

P.S. I wonder, why is boost::container::container_detail::forward_as_tuple needed at all, since it doesn't seem to be used outside of tests. Can it be removed?

Change History (0)

Note: See TracTickets for help on using tickets.