[LLVMbugs] [Bug 23256] New: tuple<A> is_constructible attempts tuple<A> to A conversion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 16 15:01:23 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23256

            Bug ID: 23256
           Summary: tuple<A> is_constructible attempts tuple<A> to A
                    conversion
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eugeni.stepanov at gmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

I'm not sure this is a bug, but...
std::is_trivially_copy_constructible<std::tuple<A>>::value instantiates A's
type conversion constructor with tuple<A> as an argument. Is it allowed to do
that?

#include <tuple>

class A {
public:
  A() : value_(0) {}

  template <typename T>
  explicit constexpr A(T value)
      : value_(static_cast<int>(value)) {}

private:
  int value_;
};

A a;
A b(a);

static_assert(std::is_trivially_copy_constructible<std::tuple<A>>::value,
"zz");


$ ./bin/clang++ ../1.cc -c -std=c++11 -stdlib=libc++

../1.cc:9:16: error: cannot convert 'std::__1::tuple<A>' to 'int' without a
conversion operator
      : value_(static_cast<int>(value)) {}
               ^~~~~~~~~~~~~~~~~~~~~~~
/code/llvm/build/bin/../include/c++/v1/type_traits:2356:38: note: in
instantiation of function template specialization
      'A::A<std::__1::tuple<A> >' requested here
    : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
                                     ^
/code/llvm/build/bin/../include/c++/v1/__tuple:303:32: note: in instantiation
of template class
      'std::__1::is_constructible<A, const std::__1::tuple<A> &>' requested
here
                               is_constructible<_Up0, _Tp0>::value &&
                               ^
/code/llvm/build/bin/../include/c++/v1/__tuple:315:12: note: in instantiation
of template class
      'std::__1::__tuple_constructible_imp<std::__1::__tuple_types<const
std::__1::tuple<A> &>,
      std::__1::__tuple_types<A> >' requested here
  : public __tuple_constructible_imp<
           ^
/code/llvm/build/bin/../include/c++/v1/__tuple:328:14: note: in instantiation
of template class
      'std::__1::__tuple_constructible_apply<true, std::__1::tuple<const
std::__1::tuple<A> &>,
      std::__1::__tuple_types<A> >' requested here
    : public __tuple_constructible_apply<tuple_size<typename
remove_reference<_Tp>::type>::value ==
             ^
/code/llvm/build/bin/../include/c++/v1/tuple:583:26: note: in instantiation of
template class
      'std::__1::__tuple_constructible<std::__1::tuple<const std::__1::tuple<A>
&>, std::__1::__tuple_types<A>, true,
      true>' requested here
                         __tuple_constructible
                         ^
/code/llvm/build/bin/../include/c++/v1/tuple:610:9: note: while substituting
prior template arguments into non-type
      template parameter [with _Up = <const std::__1::tuple<A> &>]
        tuple(_Up&&... __u)
        ^~~~~
/code/llvm/build/bin/../include/c++/v1/type_traits:2689:31: note: while
substituting deduced template arguments into
      function template 'tuple' [with _Up = <const std::__1::tuple<A> &>, $1 =
(no value)]
    : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)>
                              ^
/code/llvm/build/bin/../include/c++/v1/type_traits:2817:14: note: in
instantiation of template class
      'std::__1::is_trivially_constructible<std::__1::tuple<A>, const
std::__1::tuple<A> &>' requested here
    : public is_trivially_constructible<_Tp, typename
add_lvalue_reference<const _Tp>::type>
             ^
../1.cc:18:20: note: in instantiation of template class
'std::__1::is_trivially_copy_constructible<std::__1::tuple<A> >'
      requested here
static_assert(std::is_trivially_copy_constructible<std::tuple<A>>::value,
"zz");

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150416/060add03/attachment.html>


More information about the llvm-bugs mailing list