This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [C++ PATCH, RFC] Implement new C++ intrinsics __is_assignable and __is_constructible.
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- Cc: Jason Merrill <jason at redhat dot com>, Daniel Krügler <daniel dot kruegler at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Wed, 17 May 2017 14:45:03 +0100
- Subject: Re: [C++ PATCH, RFC] Implement new C++ intrinsics __is_assignable and __is_constructible.
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jwakely at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5A0B58123F
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5A0B58123F
- References: <CAFk2RUZAj3wo0_ExOsRwZkMW-YvFjM4mtBi2-C+kHzX5ziTziw@mail.gmail.com> <CAGNvRgB23PyyzpxhkXbrUNesvtZXyKVGLNsEt=P78x0RSS3BsQ@mail.gmail.com> <CAFk2RUafnmokecDgnM3OFb0FZrqx8zNNiCVjE_FV=GN4uD7npQ@mail.gmail.com> <CAFk2RUb1sf7QNTGqEujfx2YmxJsx1+EuTca2GWs=t8ufVJQ6jA@mail.gmail.com> <CADzB+2kkSYtABpSTPKWjHcSp1nV8EtMgz1JEo490Cy71ivuJFw@mail.gmail.com> <CAFk2RUZcKpTaM_Egf8huvmcXRgkLELhDUe2V00r7DnCOQmZy_g@mail.gmail.com>
On 17/05/17 15:15 +0300, Ville Voutilainen wrote:
One more round. This patch doesn't change any of the compiler bits,
but the llvm testsuite revealed
that we didn't handle things like
is_trivially_copy_constructible<void> properly, so I needed to adjust
the library implementation of the triviality-traits. Now we pass the
llvm testsuite for these traits,
and this patch passes our full testsuite.
Jonathan, ok for trunk?
Yes OK, thanks.
A few observations ...
@@ -1405,45 +1185,95 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
/// is_trivially_copy_constructible
+
+ template<typename _Tp, bool = __is_referenceable<_Tp>::value>
+ struct __is_trivially_copy_constructible_impl;
+
template<typename _Tp>
- struct is_trivially_copy_constructible
+ struct __is_trivially_copy_constructible_impl<_Tp, false>
+ : public false_type { };
+
+ template<typename _Tp>
+ struct __is_trivially_copy_constructible_impl<_Tp, true>
: public __and_<is_copy_constructible<_Tp>,
integral_constant<bool,
__is_trivially_constructible(_Tp, const _Tp&)>>
{ };
This could use __bool_constant, and there doesn't seem to be any
advantage to using __and_ here, because there's nothing to
short-circuit. So:
: public __bool_constant<is_copy_constructible<_Tp>::value
&& __is_trivially_constructible(_Tp, const _Tp&)>
But that was pre-existing, so let's deal with that
separately.
+ template<typename _Tp>
+ struct __is_trivially_move_constructible_impl<_Tp, true>
: public __and_<is_move_constructible<_Tp>,
integral_constant<bool,
__is_trivially_constructible(_Tp, _Tp&&)>>
{ };
Ditto.
+ template<typename _Tp>
+ struct __is_trivially_copy_assignable_impl<_Tp, true>
: public __and_<is_copy_assignable<_Tp>,
integral_constant<bool,
__is_trivially_assignable(_Tp&, const _Tp&)>>
{ };
Ditto.
+ template<typename _Tp>
+ struct __is_trivially_move_assignable_impl<_Tp, true>
: public __and_<is_move_assignable<_Tp>,
integral_constant<bool,
__is_trivially_assignable(_Tp&, _Tp&&)>>
Ditto.