[LLVMbugs] [Bug 21157] New: tuple: non-default constructible tuple hard failure
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Oct 4 07:48:24 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=21157
Bug ID: 21157
Summary: tuple: non-default constructible tuple hard failure
Product: libc++
Version: 3.4
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: ldionne.2 at gmail.com
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
Classification: Unclassified
When using the is_default_constructible trait with a tuple that has non
default-constructible elements, a hard compilation error happens instead
of the trait returning false. I'm pretty sure this should not happen, but
I'm not sure why it does even after looking at the code for a while. I think
it has to do with the default constructor of std::tuple being defined
regardless of the default-constructibility of its elements.
Test case
------------------------------------------------------------------------------
#include <tuple>
#include <type_traits>
struct nodefault {
nodefault() = delete;
};
static_assert(!std::is_default_constructible<
std::tuple<nodefault>
>::value, "");
int main() { }
------------------------------------------------------------------------------
Compiler output:
------------------------------------------------------------------------------
› ~/code/llvm/release/bin/clang++ -ftemplate-backtrace-limit=0 -std=c++1y
-o/dev/null ~/desktop/bugreports/tuple_default/tc1.cpp
In file included from
/Users/ldionne/desktop/bugreports/tuple_default/tc1.cpp:3:
/Users/ldionne/code/llvm/projects/libcxx/include/tuple:307:49: error: call to
deleted constructor of 'nodefault'
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
^
/Users/ldionne/code/llvm/projects/libcxx/include/tuple:402:23: note: in
instantiation of member function 'std::__1::__tuple_leaf<0, nodefault,
true>::__tuple_leaf' requested here
_LIBCPP_CONSTEXPR __tuple_impl()
^
/Users/ldionne/code/llvm/projects/libcxx/include/tuple:516:23: note: in
instantiation of member function
'std::__1::__tuple_impl<std::__1::__tuple_indices<0>, nodefault>::__tuple_impl'
requested here
_LIBCPP_CONSTEXPR tuple()
^
/Users/ldionne/code/llvm/projects/libcxx/include/type_traits:2445:31: note: in
instantiation of member function 'std::__1::tuple<nodefault>::tuple' requested
here
: integral_constant<bool, __is_constructible(_Tp, _Args...)>
^
/Users/ldionne/code/llvm/projects/libcxx/include/type_traits:2637:14: note: in
instantiation of template class
'std::__1::is_constructible<std::__1::tuple<nodefault>>' requested here
: public is_constructible<_Tp>
^
/Users/ldionne/desktop/bugreports/tuple_default/tc1.cpp:11:21: note: in
instantiation of template class
'std::__1::is_default_constructible<std::__1::tuple<nodefault> >' requested
here
static_assert(!std::is_default_constructible<
^
/Users/ldionne/desktop/bugreports/tuple_default/tc1.cpp:8:5: note: 'nodefault'
has been explicitly marked deleted here
nodefault() = delete;
^
/Users/ldionne/desktop/bugreports/tuple_default/tc1.cpp:11:1: error:
static_assert failed ""
static_assert(!std::is_default_constructible<
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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/20141004/20cbece2/attachment.html>
More information about the llvm-bugs
mailing list