[LLVMbugs] [Bug 19616] New: tuple_cat of nested tuples fails in noexcept specification
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Apr 30 09:43:26 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19616
Bug ID: 19616
Summary: tuple_cat of nested tuples fails in noexcept
specification
Product: libc++
Version: unspecified
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: zerolo at gmail.com
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
Classification: Unclassified
Created attachment 12458
--> http://llvm.org/bugs/attachment.cgi?id=12458&action=edit
example failing to compile with "clang++ --std=c++11"
libc++ version is the one included in Xcode 5.1.1
#include <tuple>
std::tuple<std::tuple<const int *> > F()
{
return std::make_tuple(std::make_tuple(nullptr));
}
int main (int argc, char const *argv[])
{
auto t1 = F();
auto works = std::tuple_cat(t1, t2);
auto breaks = std::tuple_cat(F(), F());
return 0;
}
The attached example attempts to concatenate two nested tuples. I think it is
correct, but it may not be.
The code files without error with g++ 4.8.1 with libstdc++.
I'm not quite sure what to make of the error messages, it doesn't seem to be
the compiler getting anything wrong.
The rvalue-ness of the arguments seems to be important to triggering the error.
The attached example when compiled with Xcode 5.1.1's clang (Apple LLVM version
5.1 (clang-503.0.40) (based on LLVM 3.4svn))
fails as follows:
> clang++ --std=c++11 test_tuple.cpp
In file included from test_tuple.cpp:1:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:124:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tuple:16:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:2537:47:
error: cannot cast from lvalue of type 'const int *' to rvalue
reference type 'std::__1::tuple<const int *> &&'; types are not
compatible
: public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
^~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:2549:7:
note: in instantiation of template class
'std::__1::__is_nothrow_constructible<true, std::__1::tuple<const int *>
&&, const int *>' requested here
: __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp,
_Args...>
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:425:54:
note: in instantiation of template class
'std::__1::is_nothrow_constructible<std::__1::tuple<const int *> &&,
const int *>' requested here
__tuple_impl(_Tuple&& __t)
_NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config:332:34:
note: expanded from macro '_NOEXCEPT_'
# define _NOEXCEPT_(x) noexcept(x)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:2537:47:
note: in instantiation of exception specification for
'__tuple_impl<std::__1::tuple<const int *>, void>' requested here
: public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:2549:7:
note: in instantiation of template class
'std::__1::__is_nothrow_constructible<true,
std::__1::__tuple_impl<std::__1::__tuple_indices<0>, std::__1::tuple<const int
*> &&>, std::__1::tuple<const int *> >' requested here
: __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp,
_Args...>
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:630:41:
note: in instantiation of template class
'std::__1::is_nothrow_constructible<std::__1::__tuple_impl<std::__1::__tuple_indices<0>,
std::__1::tuple<const int *> &&>, std::__1::tuple<const int *> >' requested
here
tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base,
_Tuple>::value))
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config:332:34:
note: expanded from macro '_NOEXCEPT_'
# define _NOEXCEPT_(x) noexcept(x)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:849:12:
note: in instantiation of exception specification for
'tuple<std::__1::tuple<const int *>, false>' requested here
return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:1047:16:
note: in instantiation of function template specialization
'std::__1::forward_as_tuple<std::__1::tuple<const int *> >' requested
here
return forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))...,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:1058:16:
note: in instantiation of function template specialization
'std::__1::__tuple_cat<std::__1::tuple<>, std::__1::__tuple_indices<>,
std::__1::__tuple_indices<0>
>::operator()<std::__1::tuple<std::__1::tuple<const int *> > >' requested here
return __tuple_cat<
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:1077:12:
note: in instantiation of function template specialization
'std::__1::__tuple_cat<std::__1::tuple<>, std::__1::__tuple_indices<>,
std::__1::__tuple_indices<> >::operator()<std::__1::tuple<>,
std::__1::tuple<std::__1::tuple<const int *> >>'
requested here
return __tuple_cat<tuple<>, __tuple_indices<>,
^
test_tuple.cpp:10:22: note: in instantiation of function template
specialization 'std::__1::tuple_cat<std::__1::tuple<>,
std::__1::tuple<std::__1::tuple<const int *> > >' requested here
auto catted = std::tuple_cat(std::make_tuple(), F());
^
In file included from test_tuple.cpp:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:208:90:
error: no member named 'value' in
'std::__1::is_nothrow_constructible<std::__1::tuple<const int *> &&,
const int *>'
explicit __tuple_leaf(_Tp&& __t)
_NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config:332:34:
note: expanded from macro '_NOEXCEPT_'
# define _NOEXCEPT_(x) noexcept(x)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:427:15:
note: in instantiation of exception specification for
'__tuple_leaf<const int *, void>' requested here
: __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename
tuple_element<_Indx,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:631:15:
note: in instantiation of function template specialization
'std::__1::__tuple_impl<std::__1::__tuple_indices<0>,
std::__1::tuple<const int *> &&>::__tuple_impl<std::__1::tuple<const int *>,
void>' requested here
: base_(_VSTD::forward<_Tuple>(__t)) {}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:849:12:
note: in instantiation of function template specialization
'std::__1::tuple<std::__1::tuple<const int *>
&&>::tuple<std::__1::tuple<const int *>, false>' requested here
return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:1047:16:
note: in instantiation of function template specialization
'std::__1::forward_as_tuple<std::__1::tuple<const int *> >' requested
here
return forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))...,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:1058:16:
note: in instantiation of function template specialization
'std::__1::__tuple_cat<std::__1::tuple<>, std::__1::__tuple_indices<>,
std::__1::__tuple_indices<0>
>::operator()<std::__1::tuple<std::__1::tuple<const int *> > >' requested here
return __tuple_cat<
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:1077:12:
note: in instantiation of function template specialization
'std::__1::__tuple_cat<std::__1::tuple<>, std::__1::__tuple_indices<>,
std::__1::__tuple_indices<> >::operator()<std::__1::tuple<>,
std::__1::tuple<std::__1::tuple<const int *> >>'
requested here
return __tuple_cat<tuple<>, __tuple_indices<>,
^
test_tuple.cpp:10:22: note: in instantiation of function template
specialization 'std::__1::tuple_cat<std::__1::tuple<>,
std::__1::tuple<std::__1::tuple<const int *> > >' requested here
auto catted = std::tuple_cat(std::make_tuple(), F());
^
2 errors generated.
--
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/20140430/317bcf5e/attachment.html>
More information about the llvm-bugs
mailing list