<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - wrong template instantiation when using a tuple of tuple"
   href="https://llvm.org/bugs/show_bug.cgi?id=25622">25622</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wrong template instantiation when using a tuple of tuple
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mpatzlaff@benocs.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15347" name="attach_15347" title="minimial (non-)working example">attachment 15347</a> <a href="attachment.cgi?id=15347&action=edit" title="minimial (non-)working example">[details]</a></span>
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>
<span class="quote">>::fancyMethod'</span >
      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>
<span class="quote">>::Derived'</span >
      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>
<span class="quote">>' is implicitly deleted because field 'base_' has a deleted copy constructor</span >
    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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>