2007-06-26 17:58:45 +02:00
|
|
|
// { dg-options "-std=gnu++0x" }
|
2007-08-23 18:16:41 +02:00
|
|
|
// 2007-06-05 Benjamin Kosnik <bkoz@redhat.com>
|
2007-06-26 17:58:45 +02:00
|
|
|
|
2009-02-18 08:35:36 +01:00
|
|
|
// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
|
2007-06-26 17:58:45 +02:00
|
|
|
//
|
|
|
|
// 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
|
2009-04-09 17:00:19 +02:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2007-06-26 17:58:45 +02:00
|
|
|
// 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
|
2009-04-09 17:00:19 +02:00
|
|
|
// with this library; see the file COPYING3. If not see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2007-06-26 17:58:45 +02:00
|
|
|
|
2007-08-23 18:16:41 +02:00
|
|
|
#include <cstring>
|
|
|
|
#include <system_error>
|
|
|
|
#include <testsuite_hooks.h>
|
2007-06-26 17:58:45 +02:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2007-08-23 18:16:41 +02:00
|
|
|
bool test __attribute__((unused)) = true;
|
|
|
|
const std::string s("too late: boulangerie out of pain au raisin");
|
2009-04-25 21:00:52 +02:00
|
|
|
const std::error_code
|
|
|
|
e(std::make_error_code(std::errc::operation_not_supported));
|
2007-08-23 18:16:41 +02:00
|
|
|
|
|
|
|
// 1
|
|
|
|
{
|
2008-05-16 23:55:00 +02:00
|
|
|
std::system_error err1(e, s);
|
2007-08-23 18:16:41 +02:00
|
|
|
VERIFY( err1.code() == e );
|
|
|
|
VERIFY( std::strcmp(err1.runtime_error::what(), s.c_str()) == 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
// 2
|
|
|
|
{
|
2009-02-18 08:35:36 +01:00
|
|
|
std::system_error err2(95, std::system_category(), s);
|
|
|
|
VERIFY( err2.code() == std::error_code(95, std::system_category()) );
|
2007-08-23 18:16:41 +02:00
|
|
|
VERIFY( std::strcmp(err2.runtime_error::what(), s.c_str()) == 0 );
|
|
|
|
}
|
|
|
|
|
2007-06-26 17:58:45 +02:00
|
|
|
return 0;
|
|
|
|
}
|