diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2009-04-25 19:00:52 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2009-04-25 19:00:52 +0000 |
commit | bb81f9a082bc39f847937cc427385bfdd70dc237 (patch) | |
tree | dff3f878c04d4a0551eac623b67d5609ced0bca9 /libstdc++-v3/testsuite/19_diagnostics/error_code/modifiers/39882.cc | |
parent | 813b9e7e207682f15e79337a239a78d5b9c12d43 (diff) | |
download | gcc-bb81f9a082bc39f847937cc427385bfdd70dc237.tar.gz |
re PR libstdc++/39880 (Specialisation is_error_code_enum<errc> should not exist)
2009-04-25 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/39880
PR libstdc++/39881
PR libstdc++/39882
* include/std/system_error (is_error_code_enum<errc>): Remove.
(error_condition<>::error_condition(_ErrorCodeEnum,)
error_condition<>::operator=(_ErrorCodeEnum)): Use make_error_condition.
(error_code<>::error_code(_ErrorCodeEnum,),
error_code<>::operator=(_ErrorCodeEnum)): Use make_error_code.
* testsuite/19_diagnostics/system_error/39880.cc: New.
* testsuite/19_diagnostics/error_condition/modifiers/39881.cc:
Likewise.
* testsuite/19_diagnostics/error_condition/cons/39881.cc: Likewise.
* testsuite/19_diagnostics/error_code/modifiers/39882.cc: Likewise.
* testsuite/19_diagnostics/error_code/cons/39882.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc:
Adjust.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc:
Likewise.
* testsuite/19_diagnostics/error_code/cons/1.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/bool.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/equal.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/not_equal.cc:
Likewise.
* testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Likewise.
* testsuite/19_diagnostics/system_error/cons-1.cc: Likewise.
* testsuite/19_diagnostics/system_error/what-4.cc: Likewise.
* testsuite/30_threads/unique_lock/locking/2.cc: Likewise.
From-SVN: r146780
Diffstat (limited to 'libstdc++-v3/testsuite/19_diagnostics/error_code/modifiers/39882.cc')
-rw-r--r-- | libstdc++-v3/testsuite/19_diagnostics/error_code/modifiers/39882.cc | 61 |
1 files changed, 61 insertions, 0 deletions
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; +} |