<html>
<head>
<base href="http://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 --- - c++1y tuple constructor mistakes arguments for allocator?"
href="http://llvm.org/bugs/show_bug.cgi?id=19793">19793</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>c++1y tuple constructor mistakes arguments for allocator?
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>zerolo@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu, 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=12541" name="attach_12541" title="Example failing using -std=c++1y">attachment 12541</a> <a href="attachment.cgi?id=12541&action=edit" title="Example failing using -std=c++1y">[details]</a></span>
Example failing using -std=c++1y
The attached code compiles fine with clang using -std=c++11 but fails inside
libc++ when using -std=c++1y.
It seems that a tuple constructor mistakes its argument for an allocator, but
the actual error comes from inside an std::is_convertible check as far as I can
tell.
g++-4.9 compiles the example fine.
<span class="quote">> cat test_tuple.cpp </span >
#include <tuple>
int main (int argc, char const *argv[])
{
const int i = 5;
const auto t = std::forward_as_tuple(i, i);
auto breaks = std::forward_as_tuple(i, t, i, i);
return 0;
}
<span class="quote">> clang++ --std=c++1y test_tuple.cpp </span >
In file included from test_tuple.cpp:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:180:73:
error: reference to type 'const int' requires an initializer
_NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value()
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:402:13:
note: in instantiation of member function
'std::__1::__tuple_leaf<1, const int &, false>::__tuple_leaf' requested
here
__tuple_leaf<_Ul, _Tl>()...
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:552:15:
note: in instantiation of function template specialization
'std::__1::__tuple_impl<std::__1::__tuple_indices<0, 1>, const int &,
const int &>::__tuple_impl<0, const int &, 1, const int &, const int &>'
requested here
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:802:38:
note: in instantiation of function template specialization
'std::__1::tuple<const int &, const int &>::tuple<const int &, false>'
requested here
: public integral_constant<bool, __is_convertible_to(_T1, _T2) &&
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tuple:228:32:
note: in instantiation of template class 'std::__1::is_convertible<const int &,
const std::__1::tuple<const int &, const int &> &>' requested here
is_convertible<_Tp0, _Up0>::value &&
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tuple:229:32:
note: in instantiation of template class
'std::__1::__tuple_convertible_imp<true,
std::__1::__tuple_types<const int &>, std::__1::__tuple_types<const
std::__1::tuple<const int &, const int &> &> >' requested here
__tuple_convertible_imp<true,
__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tuple:242:14:
note: in instantiation of template class
'std::__1::__tuple_convertible_imp<true,
std::__1::__tuple_types<const int &, const int &>,
std::__1::__tuple_types<const int &, const std::__1::tuple<const int &, const
int &> &> >' requested here
: public __tuple_convertible_imp<tuple_size<typename
remove_reference<_Tp>::type>::value ==
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:603:26:
note: in instantiation of template class
'std::__1::__tuple_convertible<std::__1::tuple<const int &, const int &>,
std::__1::__tuple_types<const int &, const std::__1::tuple<const int &, const
int &> &>, true, true>' requested here
__tuple_convertible
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:614:9:
note: in instantiation of default argument for 'tuple<std::__1::tuple<const int
&,
const int &>, const int &, const int &>' required here
tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
^~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:614:9:
note: while substituting deduced template arguments into function template
'tuple'
[with _Alloc = std::__1::tuple<const int &, const int &>, _Up = <const
int &, const int &>, $2 = <no value>]
tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
^
test_tuple.cpp:7:22: note: in instantiation of function template specialization
'std::__1::forward_as_tuple<const int &, const std::__1::tuple<const int &,
const int &> &, const int &, const int &>'
requested here
auto breaks = std::forward_as_tuple(i, t, i, i);
^
In file included from test_tuple.cpp:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:181:9:
error: static_assert failed
"Attempted to default construct a reference element in a tuple"
{static_assert(!is_reference<_Hp>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.</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>