diff options
Diffstat (limited to 'libstdc++-v3/testsuite')
15 files changed, 244 insertions, 22 deletions
diff --git a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc index c0d1a6e5885..b5105dff38b 100644 --- a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc +++ b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc @@ -26,6 +26,6 @@ test01() // std::numeric_limits<int64_t>::max() == 9223372036854775807; auto h = 9223372036854775808h; - // { dg-error "cannot be represented" "" { target *-*-* } 892 } + // { dg-error "cannot be represented" "" { target *-*-* } 880 } } // { dg-prune-output "in constexpr expansion" } // needed for -O0 diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc index 189e97bf984..17f74187098 100644 --- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc +++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc @@ -30,4 +30,4 @@ void test01() test_type d; // { dg-error "required from here" } } -// { dg-error "rep cannot be a duration" "" { target *-*-* } 308 } +// { dg-error "rep cannot be a duration" "" { target *-*-* } 300 } diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc index 501de5ee752..282a9dbdc85 100644 --- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc +++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc @@ -31,5 +31,5 @@ void test01() test_type d; // { dg-error "required from here" } } -// { dg-error "must be a specialization of ratio" "" { target *-*-* } 309 } +// { dg-error "must be a specialization of ratio" "" { target *-*-* } 301 } // { dg-prune-output "not a member" } diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc index a56bb96f5d0..c57f9d947a5 100644 --- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc +++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc @@ -32,4 +32,4 @@ void test01() test_type d; // { dg-error "required from here" } } -// { dg-error "period must be positive" "" { target *-*-* } 311 } +// { dg-error "period must be positive" "" { target *-*-* } 303 } diff --git a/libstdc++-v3/testsuite/20_util/forward/c_neg.cc b/libstdc++-v3/testsuite/20_util/forward/c_neg.cc index c7830d7b2d4..d098164c0f7 100644 --- a/libstdc++-v3/testsuite/20_util/forward/c_neg.cc +++ b/libstdc++-v3/testsuite/20_util/forward/c_neg.cc @@ -17,7 +17,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 86 } +// { dg-error "static assertion failed" "" { target *-*-* } 87 } #include <list> diff --git a/libstdc++-v3/testsuite/20_util/forward/f_neg.cc b/libstdc++-v3/testsuite/20_util/forward/f_neg.cc index 7d073fe822b..0ca36d4b5a6 100644 --- a/libstdc++-v3/testsuite/20_util/forward/f_neg.cc +++ b/libstdc++-v3/testsuite/20_util/forward/f_neg.cc @@ -17,7 +17,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 86 } +// { dg-error "static assertion failed" "" { target *-*-* } 87 } #include <utility> diff --git a/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc b/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc index d88f145d754..8c3494d7041 100644 --- a/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc +++ b/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc @@ -31,9 +31,9 @@ test01() std::gcd(0.1, 0.1); // { dg-error "from here" } } -// { dg-error "integers" "" { target *-*-* } 134 } -// { dg-error "integers" "" { target *-*-* } 135 } -// { dg-error "not bools" "" { target *-*-* } 136 } -// { dg-error "not bools" "" { target *-*-* } 137 } +// { dg-error "integers" "" { target *-*-* } 130 } +// { dg-error "integers" "" { target *-*-* } 131 } +// { dg-error "not bools" "" { target *-*-* } 132 } +// { dg-error "not bools" "" { target *-*-* } 133 } // { dg-prune-output "deleted function" } // { dg-prune-output "invalid operands" } diff --git a/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc b/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc index f2d82894531..abcac4f18c1 100644 --- a/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc +++ b/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc @@ -31,9 +31,9 @@ test01() std::lcm(0.1, 0.1); // { dg-error "from here" } } -// { dg-error "integers" "" { target *-*-* } 147 } -// { dg-error "integers" "" { target *-*-* } 148 } -// { dg-error "not bools" "" { target *-*-* } 149 } -// { dg-error "not bools" "" { target *-*-* } 150 } +// { dg-error "integers" "" { target *-*-* } 143 } +// { dg-error "integers" "" { target *-*-* } 144 } +// { dg-error "not bools" "" { target *-*-* } 145 } +// { dg-error "not bools" "" { target *-*-* } 146 } // { dg-prune-output "deleted function" } // { dg-prune-output "invalid operands" } diff --git a/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc b/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc index ad2cbc6e71b..22485222f28 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc @@ -9,6 +9,6 @@ std::__detail::_Adaptor<std::mt19937, unsigned long> aurng(urng); auto x = std::generate_canonical<std::size_t, std::numeric_limits<std::size_t>::digits>(urng); -// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 160 } +// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 156 } -// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 3314 } +// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 3311 } diff --git a/libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc new file mode 100644 index 00000000000..a319aff1c62 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc @@ -0,0 +1,64 @@ +// Copyright (C) 2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-require-fileio "" } + +// PR libstdc++/53984 + +#include <fstream> +#include <testsuite_hooks.h> + +void +test01() +{ + std::ifstream in("."); + if (in) + { + char c; + if (in.get(c)) + { + // Reading a directory doesn't produce an error on this target + // so the formatted input functions below wouldn't fail anyway + // (see PR libstdc++/81808). + return; + } + int x; + in.clear(); + // Formatted input function should set badbit, but not throw: + in >> x; + VERIFY( in.bad() ); + + in.clear(); + in.exceptions(std::ios::badbit); + try + { + // Formatted input function should set badbit, and throw: + in >> x; + VERIFY( false ); + } + catch (const std::exception&) + { + VERIFY( in.bad() ); + } + } +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/53984.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/53984.cc new file mode 100644 index 00000000000..9c08c7236da --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/53984.cc @@ -0,0 +1,41 @@ +// Copyright (C) 2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <streambuf> +#include <istream> +#include <testsuite_hooks.h> + +struct SB : std::streambuf +{ + virtual int_type underflow() { throw 1; } +}; + +void +test01() +{ + SB sb; + std::istream is(&sb); + int i; + is >> i; + VERIFY( is.bad() ); +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/27_io/types/1.cc b/libstdc++-v3/testsuite/27_io/types/1.cc index 88f6ff868d7..0756f8a1709 100644 --- a/libstdc++-v3/testsuite/27_io/types/1.cc +++ b/libstdc++-v3/testsuite/27_io/types/1.cc @@ -15,6 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. +// { dg-do compile { target c++14_down } } + // 27.4.2.1 - Types [lib.ios.types] #include <ios> @@ -27,9 +29,3 @@ void test01() typedef std::ios_base::streampos streampos_type; typedef std::ios_base::streamoff streamoff_type; } - -int main(void) -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/27_io/types/4.cc b/libstdc++-v3/testsuite/27_io/types/4.cc new file mode 100644 index 00000000000..ee1a77736ce --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/types/4.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++17" } +// { dg-do compile { target c++1z } } + +// In C++17 these names are not reserved by the library. +#define io_state 1 +#define open_mode 2 +#define seek_dir 3 +#define stossc 4 +#include <streambuf> + +template class std::basic_streambuf<char>; +template class std::basic_streambuf<wchar_t>; diff --git a/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc new file mode 100644 index 00000000000..ba566f869c6 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc @@ -0,0 +1,39 @@ +// Copyright (C) 2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-require-fileio "" } + +#include <ext/stdio_filebuf.h> +#include <cstdio> +#include <cerrno> +#include <testsuite_hooks.h> + +void +test01() +{ + FILE* f = std::fopen("79820.txt", "w"); + std::fclose(f); + errno = 127; + __gnu_cxx::stdio_filebuf<char> b(f, std::ios::out, BUFSIZ); + VERIFY(errno == 127); // PR libstdc++/79820 +} + +int +main() +{ + test01(); +} diff --git a/libstdc++-v3/testsuite/ext/stdio_filebuf/char/81751.cc b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/81751.cc new file mode 100644 index 00000000000..22191dcb6a3 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/81751.cc @@ -0,0 +1,53 @@ +// Copyright (C) 2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-require-fileio "" } + +#include <ext/stdio_filebuf.h> +#include <cstdio> +#include <cerrno> +#include <testsuite_hooks.h> + +void +test01() +{ + FILE* out = std::fopen("81751.txt", "w"); + std::fwrite("Some words.", 1, 10, out); + + FILE* in1 = std::fopen("81751.txt", "r"); + __gnu_cxx::stdio_filebuf<char> buf1(in1, std::ios::in, BUFSIZ); + int c = buf1.sgetc(); + VERIFY( c == std::char_traits<char>::eof() ); // PR libstdc++/81751 + + std::fflush(out); + FILE* in2 = std::fopen("81751.txt", "r"); + __gnu_cxx::stdio_filebuf<char> buf2(in2, std::ios::in, BUFSIZ); + c = buf2.sgetc(); + VERIFY( c == 'S' ); + + buf1.close(); + buf2.close(); + std::fclose(in1); + std::fclose(in2); + std::fclose(out); +} + +int +main() +{ + test01(); +} |