* [PATCH] Add noexcept to tuple<> and simplify tuple<T1,T2> noexcept-specifiers
@ 2019-05-31 14:58 Jonathan Wakely
2019-06-03 9:44 ` Szabolcs Nagy
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2019-05-31 14:58 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
* include/std/tuple (tuple<>): Add noexcept to allocator-extended
constructors.
(tuple<T1, T2>::__nothrow_default_constructible()): New helper
function.
(tuple<T1, T2>::tuple(), explicit tuple<T1, T2>::tuple()): Use helper.
Tested powerpc64le-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 3055 bytes --]
commit d099e922a9b5ca48bed5a1fa3fc5977dbdb0f070
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri May 31 11:52:47 2019 +0100
Add noexcept to tuple<> and simplify tuple<T1,T2> noexcept-specifiers
* include/std/tuple (tuple<>): Add noexcept to allocator-extended
constructors.
(tuple<T1, T2>::__nothrow_default_constructible()): New helper
function.
(tuple<T1, T2>::tuple(), explicit tuple<T1, T2>::tuple()): Use helper.
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index b81157c097b..64516b1dece 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -898,9 +898,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
tuple() = default;
// No-op allocator constructors.
template<typename _Alloc>
- tuple(allocator_arg_t, const _Alloc&) { }
+ tuple(allocator_arg_t, const _Alloc&) noexcept { }
template<typename _Alloc>
- tuple(allocator_arg_t, const _Alloc&, const tuple&) { }
+ tuple(allocator_arg_t, const _Alloc&, const tuple&) noexcept { }
};
/// Partial specialization, 2-element tuple.
@@ -925,11 +925,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
template<typename _U1, typename _U2>
- static constexpr bool __nothrow_constructible()
- {
- return __and_<is_nothrow_constructible<_T1, _U1>,
- is_nothrow_constructible<_T2, _U2>>::value;
- }
+ static constexpr bool __nothrow_constructible()
+ {
+ return __and_<is_nothrow_constructible<_T1, _U1>,
+ is_nothrow_constructible<_T2, _U2>>::value;
+ }
+
+ static constexpr bool __nothrow_default_constructible()
+ {
+ return __and_<is_nothrow_default_constructible<_T1>,
+ is_nothrow_default_constructible<_T2>>::value;
+ }
public:
template <typename _U1 = _T1,
@@ -939,8 +945,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__is_implicitly_default_constructible<_U2>>
::value, bool>::type = true>
constexpr tuple()
- noexcept(__and_<is_nothrow_default_constructible<_T1>,
- is_nothrow_default_constructible<_T2>>::value)
+ noexcept(__nothrow_default_constructible())
: _Inherited() { }
template <typename _U1 = _T1,
@@ -954,8 +959,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__is_implicitly_default_constructible<_U2>>>>
::value, bool>::type = false>
explicit constexpr tuple()
- noexcept(__and_<is_nothrow_default_constructible<_T1>,
- is_nothrow_default_constructible<_T2>>::value)
+ noexcept(__nothrow_default_constructible())
: _Inherited() { }
// Shortcut for the cases where constructors taking _T1, _T2
@@ -1108,7 +1112,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& _TCC<_Dummy>::template
_ImplicitlyConvertibleTuple<_T1, _T2>(),
bool>::type=true>
-
tuple(allocator_arg_t __tag, const _Alloc& __a,
const _T1& __a1, const _T2& __a2)
: _Inherited(__tag, __a, __a1, __a2) { }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add noexcept to tuple<> and simplify tuple<T1,T2> noexcept-specifiers
2019-05-31 14:58 [PATCH] Add noexcept to tuple<> and simplify tuple<T1,T2> noexcept-specifiers Jonathan Wakely
@ 2019-06-03 9:44 ` Szabolcs Nagy
2019-06-03 9:46 ` Jonathan Wakely
0 siblings, 1 reply; 3+ messages in thread
From: Szabolcs Nagy @ 2019-06-03 9:44 UTC (permalink / raw)
To: Jonathan Wakely, libstdc++, gcc-patches; +Cc: nd
On 31/05/2019 15:58, Jonathan Wakely wrote:
> * include/std/tuple (tuple<>): Add noexcept to allocator-extended
> constructors.
> (tuple<T1, T2>::__nothrow_default_constructible()): New helper
> function.
> (tuple<T1, T2>::tuple(), explicit tuple<T1, T2>::tuple()): Use helper.
>
> Tested powerpc64le-linux, committed to trunk.
on aarch64* i see
FAIL: g++.dg/cpp0x/noexcept15.C -std=c++14 (test for excess errors)
In file included from /S/gcc/testsuite/g++.dg/cpp0x/noexcept15.C:4:
/B/aarch64-none-linux-gnu/libstdc++-v3/include/type_traits: In instantiation of 'struct std::is_nothrow_move_constructible<Blob>':
/S/gcc/testsuite/g++.dg/cpp0x/noexcept15.C:14:5: required from 'single<Tp>::single(single<Tp>&&) [with Tp = Blob]'
/S/gcc/testsuite/g++.dg/cpp0x/noexcept15.C:23:51: required from 'constexpr single<typename std::decay<_Tp>::type> make_single(Tp&&) [with Tp =
Blob&; typename std::decay<_Tp>::type = Blob]'
/S/gcc/testsuite/g++.dg/cpp0x/noexcept15.C:31:18: required from here
/B/aarch64-none-linux-gnu/libstdc++-v3/include/type_traits:1111:52: error: static assertion failed: template argument must be a complete class
or an unbounded array
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add noexcept to tuple<> and simplify tuple<T1,T2> noexcept-specifiers
2019-06-03 9:44 ` Szabolcs Nagy
@ 2019-06-03 9:46 ` Jonathan Wakely
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2019-06-03 9:46 UTC (permalink / raw)
To: Szabolcs Nagy; +Cc: libstdc++, gcc-patches, nd
On 03/06/19 09:44 +0000, Szabolcs Nagy wrote:
>On 31/05/2019 15:58, Jonathan Wakely wrote:
>> Â Â Â Â * include/std/tuple (tuple<>): Add noexcept to allocator-extended
>> Â Â Â Â constructors.
>> Â Â Â Â (tuple<T1, T2>::__nothrow_default_constructible()): New helper
>> Â Â Â Â function.
>> Â Â Â Â (tuple<T1, T2>::tuple(), explicit tuple<T1, T2>::tuple()): Use helper.
>>
>> Tested powerpc64le-linux, committed to trunk.
>
>on aarch64* i see
>
>FAIL: g++.dg/cpp0x/noexcept15.C -std=c++14 (test for excess errors)
>
>In file included from /S/gcc/testsuite/g++.dg/cpp0x/noexcept15.C:4:
>/B/aarch64-none-linux-gnu/libstdc++-v3/include/type_traits: In instantiation of 'struct std::is_nothrow_move_constructible<Blob>':
>/S/gcc/testsuite/g++.dg/cpp0x/noexcept15.C:14:5: required from 'single<Tp>::single(single<Tp>&&) [with Tp = Blob]'
>/S/gcc/testsuite/g++.dg/cpp0x/noexcept15.C:23:51: required from 'constexpr single<typename std::decay<_Tp>::type> make_single(Tp&&) [with Tp =
>Blob&; typename std::decay<_Tp>::type = Blob]'
>/S/gcc/testsuite/g++.dg/cpp0x/noexcept15.C:31:18: required from here
>/B/aarch64-none-linux-gnu/libstdc++-v3/include/type_traits:1111:52: error: static assertion failed: template argument must be a complete class
>or an unbounded array
Yes, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90695
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-03 9:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 14:58 [PATCH] Add noexcept to tuple<> and simplify tuple<T1,T2> noexcept-specifiers Jonathan Wakely
2019-06-03 9:44 ` Szabolcs Nagy
2019-06-03 9:46 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).