This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Adding noexcept-specification on tuple constructors (LWG 2899)
- From: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: Nina Dinka Ranns <dinka dot ranns at gmail dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>, "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 16 Apr 2019 18:10:09 +0300
- Subject: Re: Adding noexcept-specification on tuple constructors (LWG 2899)
- References: <CAAcHv8cCgCNCcVzvoW4gPT=nz=Ue55Hq9KT_1rTvnL2BLVHXMg@mail.gmail.com> <20190416141819.GU943@redhat.com>
On Tue, 16 Apr 2019 at 17:18, Jonathan Wakely <jwakely@redhat.com> wrote:
> >--- libstdc++-v3/testsuite/20_util/tuple/cons/noexcept_specs.cc (nonexistent)
> >+++ libstdc++-v3/testsuite/20_util/tuple/cons/noexcept_specs.cc (working copy)
> >@@ -0,0 +1,191 @@
> >+// { dg-options { -std=gnu++2a } }
> >+// { dg-do run { target c++2a } }
>
> This new file doesn't use std::is_nothrow_convertible so could just
> use: { dg-do run { target c++11 } } and no dg-options.
>
> For the other new tests that do use is_nothrow_convertible, I'm
> already planning to add std::is_nothrow_convertible for our internal
> use in C++11, so they could use that.
>
> Alternatively, the test files themselves could define:
>
> template<typename From, typename To>
> struct is_nothrow_convertible
> : std::integral_constant<bool,
> is_convertible<From, To> && is_nothrow_constructible<Fo, From>>
> { };
>
> and then use that. That way we can test the exception specs are
> correct in C++11 mode, the default C++14 mode, and C++17 mode.
> Otherwise we're adding code that affects all those modes but only
> testing it works correctly for the experimental C++2a mode.
That doesn't look right to me. If we go down the path of defining the
trait in the tests, let's please
copy the implementation of std::is_nothrow_convertible, which properly
uses a noexcept-check of a helper function
call (which makes the conversion be copy-initialization, since it's on
a function parameter). Otherwise,
https://wandbox.org/permlink/ALXkVVANdD4Z2AZm