https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70511

            Bug ID: 70511
           Summary: tuple constructor from elements hides copy constructor
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ivan.lelann at free dot fr
  Target Milestone: ---

This code compiles fine :

#include <iostream>
#include <tuple>
#include <boost/any.hpp>

int main()
{
    boost::any val = 12.0;
    std::tuple<boost::any> tuple_test {val};
    std::cout << std::get<0>(tuple_test).type().name() << std::endl;

    std::tuple<boost::any> tuple_test_copy {tuple_test};
    std::cout << std::get<0>(tuple_test_copy).type().name() << std::endl;
}



and prints :

d
St5tupleIJN5boost3anyEEE


Because tuple_test_copy is not copy constructed.
It is contructed from element, with implicit conversion to boost::any.

https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/tuple#L621
 

My guess it that the forwarding constructor link above here hides copy
constructor, becauses it hides the fact that a conversion will ultimately
happen.

Reply via email to