diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2018-06-14 15:12:24 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2018-06-14 15:12:24 +0100 |
commit | e9ecac306b972a45e2a6a4385bdf2bdc7f7ed68c (patch) | |
tree | 1588c66da6304cb6c241c08dbf17f45ed0186a09 /libstdc++-v3/testsuite | |
parent | 74755c6afcf45be8723e30f08b6e38ec105a636a (diff) | |
download | gcc-e9ecac306b972a45e2a6a4385bdf2bdc7f7ed68c.zip gcc-e9ecac306b972a45e2a6a4385bdf2bdc7f7ed68c.tar.gz gcc-e9ecac306b972a45e2a6a4385bdf2bdc7f7ed68c.tar.bz2 |
P0935R0 Eradicating unnecessarily explicit default constructors
More pieces of P0935R0, making default constructors non-explicit.
* include/backward/strstream (strstreambuf): Add non-explicit default
constructor.
* include/bits/locale_conv.h (wbuffer_convert, wstring_convert):
Likewise.
* include/bits/regex.h (match_results): Likewise.
* testsuite/22_locale/conversions/buffer/1.cc: Test for non-explicit
default constructor.
* testsuite/22_locale/conversions/string/1.cc: Likewise.
* testsuite/28_regex/match_results/ctors/char/default.cc: Likewise.
* testsuite/28_regex/match_results/ctors/wchar_t/default.cc: Likewise.
From-SVN: r261597
Diffstat (limited to 'libstdc++-v3/testsuite')
4 files changed, 35 insertions, 6 deletions
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc index 5d0c664..0f3f9ff 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc @@ -22,6 +22,7 @@ #include <locale> #include <sstream> #include <testsuite_hooks.h> +#include <testsuite_common_types.h> template<typename Elem> struct cvt : std::codecvt<Elem, char, std::mbstate_t> { }; @@ -42,6 +43,9 @@ void test01() VERIFY( buf.rdbuf(&sbuf) == nullptr ); VERIFY( buf.rdbuf() == &sbuf ); VERIFY( buf.rdbuf(nullptr) == &sbuf ); + + __gnu_test::implicitly_default_constructible test; + test.operator()<buf_conv<wchar_t>>(); // P0935R0 } void test02() diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc index ff26026..a2a8641 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc @@ -22,6 +22,7 @@ #include <locale> #include <string> #include <testsuite_hooks.h> +#include <testsuite_common_types.h> template<typename Elem> struct cvt : std::codecvt<Elem, char, std::mbstate_t> { }; @@ -43,6 +44,9 @@ void test01() string roundtrip = c.to_bytes(output); VERIFY( input == roundtrip ); VERIFY( c.converted() == roundtrip.length() ); + + __gnu_test::implicitly_default_constructible test; + test.operator()<sc>(); // P0935R0 } void test02() @@ -64,6 +68,9 @@ void test02() VERIFY( c.to_bytes(output[0]) == input.substr(0, 1) ); VERIFY( c.to_bytes(output.c_str()) == input ); VERIFY( c.to_bytes(output.data(), output.data()+output.size()) == input ); + + __gnu_test::implicitly_default_constructible test; + test.operator()<wsc>(); // P0935R0 } int main() diff --git a/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc b/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc index 6708c82..1023ad4 100644 --- a/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc +++ b/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc @@ -23,8 +23,9 @@ #include <regex> #include <testsuite_hooks.h> +#include <testsuite_common_types.h> -// Tests default constructor of the match_result class. +// Tests default constructor of the match_result class. void test01() { std::cmatch cm; @@ -43,10 +44,18 @@ void test02() VERIFY( sm.begin() == sm.end() ); // PR libstdc++/83600 } +void test03() +{ + // P0935R0 + __gnu_test::implicitly_default_constructible test; + test.operator()<std::cmatch>(); + test.operator()<std::smatch>(); +} + int main() -{ +{ test01(); test02(); - return 0; + test03(); } diff --git a/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc b/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc index 37bf580..f533f0e 100644 --- a/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc +++ b/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc @@ -23,8 +23,9 @@ #include <regex> #include <testsuite_hooks.h> +#include <testsuite_common_types.h> -// Tests default constructor of the match_result class. +// Tests default constructor of the match_result class. void test01() { std::wcmatch cm; @@ -43,10 +44,18 @@ void test02() VERIFY( sm.begin() == sm.end() ); // PR libstdc++/83600 } +void test03() +{ + // P0935R0 + __gnu_test::implicitly_default_constructible test; + test.operator()<std::wcmatch>(); + test.operator()<std::wsmatch>(); +} + int main() -{ +{ test01(); test02(); - return 0; + test03(); } |