summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/std/tuple
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-20 09:09:50 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-20 09:09:50 +0000
commit4b92a418770b1c0fd91203ebce2bb616cbc93995 (patch)
treecf2589681d56c8b7868a84c08fd43bf2736cf334 /libstdc++-v3/include/std/tuple
parent80898d146acccf899c8912103b28f702e706a297 (diff)
downloadppe42-gcc-4b92a418770b1c0fd91203ebce2bb616cbc93995.tar.gz
ppe42-gcc-4b92a418770b1c0fd91203ebce2bb616cbc93995.zip
PR libstdc++/51365
* include/std/tuple (_Tuple_impl): Check __is_final as well as is_empty. * testsuite/20_util/tuple/51365.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182523 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/tuple')
-rw-r--r--libstdc++-v3/include/std/tuple11
1 files changed, 8 insertions, 3 deletions
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index e8aaf4610c3..4d4691f104f 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -69,7 +69,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __add_r_ref<_Tp&>
{ typedef _Tp& type; };
- template<std::size_t _Idx, typename _Head, bool _IsEmpty>
+ template<std::size_t _Idx, typename _Head, bool _IsEmptyNotFinal>
struct _Head_base;
template<std::size_t _Idx, typename _Head>
@@ -201,6 +201,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void _M_swap(_Tuple_impl&) noexcept { /* no-op */ }
};
+ // Use the Empty Base-class Optimization for empty, non-final types.
+ template<typename _Tp>
+ using __empty_not_final
+ = typename conditional<__is_final(_Tp), false_type, is_empty<_Tp>>::type;
+
/**
* Recursive tuple implementation. Here we store the @c Head element
* and derive from a @c Tuple_impl containing the remaining elements
@@ -209,12 +214,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<std::size_t _Idx, typename _Head, typename... _Tail>
struct _Tuple_impl<_Idx, _Head, _Tail...>
: public _Tuple_impl<_Idx + 1, _Tail...>,
- private _Head_base<_Idx, _Head, std::is_empty<_Head>::value>
+ private _Head_base<_Idx, _Head, __empty_not_final<_Head>::value>
{
template<std::size_t, typename...> friend class _Tuple_impl;
typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited;
- typedef _Head_base<_Idx, _Head, std::is_empty<_Head>::value> _Base;
+ typedef _Head_base<_Idx, _Head, __empty_not_final<_Head>::value> _Base;
static constexpr _Head&
_M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
OpenPOWER on IntegriCloud