diff options
Diffstat (limited to 'libstdc++-v3/testsuite/19_diagnostics')
12 files changed, 280 insertions, 7 deletions
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc index a790a950b2b..a874814f42d 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc @@ -32,7 +32,7 @@ int main() return 0; } -// { dg-error "deleted function" "" { target *-*-* } 76 } +// { dg-error "deleted function" "" { target *-*-* } 72 } // { dg-error "used here" "" { target *-*-* } 31 } // { dg-error "first required here" "" { target *-*-* } 30 } // { dg-excess-errors "copy constructor" } diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc index b6da3866e2c..7cd280aae39 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc @@ -37,7 +37,7 @@ int main() VERIFY( e2.category() == cat ); // 3 - std::error_code e3(std::errc::operation_not_supported); + std::error_code e3(std::make_error_code(std::errc::operation_not_supported)); VERIFY( e3.value() == int(std::errc::operation_not_supported) ); VERIFY( e3.category() == std::generic_category() ); diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/39882.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/39882.cc new file mode 100644 index 00000000000..9d5c2e3338e --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/39882.cc @@ -0,0 +1,60 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2009 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 <system_error> +#include <testsuite_hooks.h> + +enum my_errc { my_err = 0 }; + +class my_error_category_impl +: public std::error_category +{ +public: + const char* name() const { return ""; } + std::string message(int) const { return ""; } +} my_error_category_instance; + +std::error_code +make_error_code(my_errc e) +{ + return std::error_code(static_cast<int>(e), + my_error_category_instance); +} + +namespace std +{ + template<> + struct is_error_code_enum<my_errc> + : public true_type {}; +} + +// libstdc++/39882 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::error_code ec1(my_err); + VERIFY( ec1 == make_error_code(my_err) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/modifiers/39882.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/modifiers/39882.cc new file mode 100644 index 00000000000..880a93655e9 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/modifiers/39882.cc @@ -0,0 +1,61 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2009 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 <system_error> +#include <testsuite_hooks.h> + +enum my_errc { my_err = 0 }; + +class my_error_category_impl +: public std::error_category +{ +public: + const char* name() const { return ""; } + std::string message(int) const { return ""; } +} my_error_category_instance; + +std::error_code +make_error_code(my_errc e) +{ + return std::error_code(static_cast<int>(e), + my_error_category_instance); +} + +namespace std +{ + template<> + struct is_error_code_enum<my_errc> + : public true_type {}; +} + +// libstdc++/39882 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::error_code ec2; + ec2 = my_err; + VERIFY( ec2 == make_error_code(my_err) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc index 93af740896a..51536032728 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc @@ -34,7 +34,7 @@ int main() } // 2 - std::error_code e2(std::errc::operation_not_supported); + std::error_code e2(std::make_error_code(std::errc::operation_not_supported)); if (e2) { VERIFY( true ); diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc index 462b184cb3c..880434c7502 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc @@ -27,7 +27,7 @@ int main() bool test __attribute__((unused)) = true; std::error_code e1; - std::error_code e2(std::errc::operation_not_supported); + std::error_code e2(std::make_error_code(std::errc::operation_not_supported)); VERIFY( e1 == e1 ); VERIFY( !(e1 == e2) ); diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc index 8de4fe1e2dc..bda2ee30e52 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc @@ -27,7 +27,7 @@ int main() bool test __attribute__((unused)) = true; std::error_code e1; - std::error_code e2(std::errc::operation_not_supported); + std::error_code e2(std::make_error_code(std::errc::operation_not_supported)); VERIFY( !(e1 != e1) ); VERIFY( e1 != e2 ); diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_condition/cons/39881.cc b/libstdc++-v3/testsuite/19_diagnostics/error_condition/cons/39881.cc new file mode 100644 index 00000000000..7931f174063 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_condition/cons/39881.cc @@ -0,0 +1,60 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2009 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 <system_error> +#include <testsuite_hooks.h> + +enum my_errc { my_err = 0 }; + +class my_error_category_impl +: public std::error_category +{ +public: + const char* name() const { return ""; } + std::string message(int) const { return ""; } +} my_error_category_instance; + +std::error_condition +make_error_condition(my_errc e) +{ + return std::error_condition(static_cast<int>(e), + my_error_category_instance); +} + +namespace std +{ + template<> + struct is_error_condition_enum<my_errc> + : public true_type { }; +} + +// libstdc++/39881 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::error_condition ec1(my_err); + VERIFY( ec1 == make_error_condition(my_err) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_condition/modifiers/39881.cc b/libstdc++-v3/testsuite/19_diagnostics/error_condition/modifiers/39881.cc new file mode 100644 index 00000000000..0178a91c418 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_condition/modifiers/39881.cc @@ -0,0 +1,61 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2009 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 <system_error> +#include <testsuite_hooks.h> + +enum my_errc { my_err = 0 }; + +class my_error_category_impl +: public std::error_category +{ +public: + const char* name() const { return ""; } + std::string message(int) const { return ""; } +} my_error_category_instance; + +std::error_condition +make_error_condition(my_errc e) +{ + return std::error_condition(static_cast<int>(e), + my_error_category_instance); +} + +namespace std +{ + template<> + struct is_error_condition_enum<my_errc> + : public true_type { }; +} + +// libstdc++/39881 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::error_condition ec2; + ec2 = my_err; + VERIFY( ec2 == make_error_condition(my_err) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/39880.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/39880.cc new file mode 100644 index 00000000000..a6ac7470c05 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/39880.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2009 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 <system_error> + +// libstdc++/39880 +void test01() +{ + std::error_code ec; + if (ec == std::errc::not_supported) + { } +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc index 11176d765a9..42f29798570 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc @@ -26,7 +26,8 @@ int main() { bool test __attribute__((unused)) = true; const std::string s("too late: boulangerie out of pain au raisin"); - const std::error_code e(std::errc::operation_not_supported); + const std::error_code + e(std::make_error_code(std::errc::operation_not_supported)); // 1 { diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc index adf8e73d3b5..2b5d51c4571 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc @@ -31,7 +31,8 @@ void test01() bool test __attribute__((unused)) = true; std::string s("after nine thirty, this request cannot be met"); - std::system_error obj = std::system_error(std::errc::invalid_argument, s); + std::system_error obj = + std::system_error(std::make_error_code(std::errc::invalid_argument), s); std::string s1(obj.what()); std::string s2(obj.what()); VERIFY( s1 == s2 ); |