This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/57139] New: std::tuple conversion constructor does the wrong checks


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57139

             Bug #: 57139
           Summary: std::tuple conversion constructor does the wrong
                    checks
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vpozdyayev@gmail.com


As per Std 20.4.2.1/14, the "template <class... UTypes> tuple(const
tuple<UTypes...>& u)" constructor should require "is_constructible<Ti, const
Ui&>". However, the implementation checks "is_convertible<const _UElements&,
_Elements>", which implies copy constructibility requirement for destination
types. As a result:

#include <type_traits>
#include <tuple>

class A {  };
class B { public: B( A const &a ) {  } private: B( B const & ); };
static_assert( std::is_constructible< B, A const & >::value, "test" ); // OK
static_assert( std::is_convertible< A, B >::value, "test" ); // fail
static_assert( std::is_constructible< std::tuple<B>, std::tuple<A> >::value,
"test" ); // fail


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]