[llvm-bugs] [Bug 25622] New: wrong template instantiation when using a tuple of tuple

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 24 02:36:42 PST 2015


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

            Bug ID: 25622
           Summary: wrong template instantiation when using a tuple of
                    tuple
           Product: libc++
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mpatzlaff at benocs.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 15347
  --> https://llvm.org/bugs/attachment.cgi?id=15347&action=edit
minimial (non-)working example

Compiling the attached example with C++14 

 clang++-3.5 -c -stdlib=libc++ -std=c++14 clang-minimal.cxx

yield an error:

clang-minimal.cxx:38:14: error: call to implicitly-deleted copy constructor of
'Derived<std::__1::__tuple_leaf<0, std::__1::tuple<Container<0> >, false> >'
    new (to) Derived<ValueType>(std::move(*this));
             ^                  ~~~~~~~~~~~~~~~~
clang-minimal.cxx:14:12: note: in instantiation of member function
'Derived<std::__1::__tuple_leaf<0, std::__1::tuple<Container<0> >, false>
>::fancyMethod'
      requested here
    inline Derived(ValueType &&value)
noexcept(std::is_nothrow_move_constructible<ValueType>::value);
           ^
clang-minimal.cxx:46:19: note: in instantiation of member function
'Derived<std::__1::__tuple_leaf<0, std::__1::tuple<Container<0> >, false>
>::Derived'
      requested here
    new (nullptr) Derived<ValueType>(std::move(value));
                  ^
/usr/include/c++/v1/tuple:322:15: note: in instantiation of function template
specialization 'Container<0>::Container<std::__1::__tuple_leaf<0,
      std::__1::tuple<Container<0> >, false> >' requested here
            : _Hp(_VSTD::forward<_Tp>(__t)) {}
              ^
clang-minimal.cxx:18:15: note: copy constructor of
'Derived<std::__1::__tuple_leaf<0, std::__1::tuple<Container<0> >, false> >' is
implicitly deleted because
      field 'value' has a deleted copy constructor
    ValueType value;
              ^
/usr/include/c++/v1/tuple:271:5: note: explicitly defaulted function was
implicitly deleted here
    __tuple_leaf(const __tuple_leaf& __t) = default;
    ^
/usr/include/c++/v1/tuple:182:9: note: copy constructor of '__tuple_leaf<0,
std::__1::tuple<Container<0> >, false>' is implicitly deleted because field
      'value' has a deleted copy constructor
    _Hp value;
        ^
/usr/include/c++/v1/tuple:490:10: note: copy constructor of 'tuple<Container<0>
>' is implicitly deleted because field 'base_' has a deleted copy constructor
    base base_;
         ^
/usr/include/c++/v1/tuple:458:5: note: explicitly defaulted function was
implicitly deleted here
    __tuple_impl(const __tuple_impl&) = default;
    ^
/usr/include/c++/v1/tuple:384:7: note: copy constructor of
'__tuple_impl<std::__1::__tuple_indices<0>, Container<0> >' is implicitly
deleted because base
      class '__tuple_leaf<0UL, Container<0> >' has a deleted copy constructor
    : public __tuple_leaf<_Indx, _Tp>...
      ^
/usr/include/c++/v1/tuple:296:7: note: copy constructor of '__tuple_leaf<0,
Container<0>, true>' is implicitly deleted because base class 'Container<0>'
has a
      deleted copy constructor
    : private _Hp
      ^
clang-minimal.cxx:24:5: note: copy constructor is implicitly deleted because
'Container<0>' has a user-declared move constructor
    Container(Container &&) noexcept(smallObjectSpace == 0u);
    ^
1 error generated.

The Derived<tuple<...>> instantiation mentioned above is wrong but we couldn't
find out where it comes from. Nevertheless we played around with the example
and got the following changes to compiler settings or code to work:

* compiling with -std=c++11 -> WORKS
* removing all noexcept operator calls -> WORKS
* changing all noexcept arguments to true/false -> WORKS
* removing definition of Derived::fancyMethod -> WORKS

I'm testing on Linux (3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u6
(2015-11-09) x86_64 GNU/Linux) using clang and libc++ version 3.5. Due to the
kind of bug, I'm not sure if it's really libc++ related or should be filed
against clang instead. So feel free to move it to the appropriate location.

-- 
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/20151124/60215c53/attachment.html>


More information about the llvm-bugs mailing list