On Tue, 16 Apr 2019 at 17:18, Jonathan Wakely <jwak...@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