1239922Sgonzo// { dg-options "-std=gnu++0x" }
2239922Sgonzo
3239922Sgonzo// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
4239922Sgonzo//
5239922Sgonzo// This file is part of the GNU ISO C++ Library.  This library is free
6239922Sgonzo// software; you can redistribute it and/or modify it under the
7239922Sgonzo// terms of the GNU General Public License as published by the
8239922Sgonzo// Free Software Foundation; either version 3, or (at your option)
9239922Sgonzo// any later version.
10239922Sgonzo
11239922Sgonzo// This library is distributed in the hope that it will be useful,
12239922Sgonzo// but WITHOUT ANY WARRANTY; without even the implied warranty of
13239922Sgonzo// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14239922Sgonzo// GNU General Public License for more details.
15239922Sgonzo
16239922Sgonzo// You should have received a copy of the GNU General Public License along
17239922Sgonzo// with this library; see the file COPYING3.  If not see
18239922Sgonzo// <http://www.gnu.org/licenses/>.
19239922Sgonzo
20239922Sgonzo#include <system_error>
21239922Sgonzo#include <testsuite_error.h>
22239922Sgonzo
23239922Sgonzovoid test01()
24239922Sgonzo{
25239922Sgonzo  bool test __attribute__((unused)) = true;
26239922Sgonzo
27239922Sgonzo  // 1
28239922Sgonzo  std::error_condition e1;
29239922Sgonzo  VERIFY( e1.value() == 0 );
30239922Sgonzo  VERIFY( e1.category() == std::generic_category() );
31239922Sgonzo
32239922Sgonzo  // 2
33239922Sgonzo  const __gnu_test::test_category cat;
34239922Sgonzo  std::error_condition e2(e1.value(), cat);
35239922Sgonzo  VERIFY( e2.value() == e1.value() );
36239922Sgonzo  VERIFY( e2.category() == cat );
37239922Sgonzo
38239922Sgonzo  // 3
39239922Sgonzo  std::error_condition e3(std::errc::operation_not_supported);
40239922Sgonzo  VERIFY( e3.value() == int(std::errc::operation_not_supported) );
41239922Sgonzo  VERIFY( e3.category() == std::generic_category() );
42239922Sgonzo}
43239922Sgonzo
44239922Sgonzoint main()
45239922Sgonzo{
46239922Sgonzo  test01();
47239922Sgonzo  return 0;
48239922Sgonzo}
49239922Sgonzo