]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 19_diagnostics / system_error / what-4.cc
CommitLineData
52066eae 1// { dg-do run { target c++11 } }
0bb81a93 2
99dee823 3// Copyright (C) 2007-2021 Free Software Foundation, Inc.
0bb81a93
BK
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
748086b7 8// Free Software Foundation; either version 3, or (at your option)
0bb81a93
BK
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License along
748086b7
JJ
17// with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
0bb81a93 19
0646d8a3 20// 19.1 Exception classes
0bb81a93 21
0646d8a3
BK
22#include <string>
23#include <system_error>
24#include <testsuite_hooks.h>
25
26// Make sure each invocation of what() doesn't grow the message.
27void test01()
28{
0646d8a3
BK
29 std::string s("after nine thirty, this request cannot be met");
30
bb81f9a0
PC
31 std::system_error obj =
32 std::system_error(std::make_error_code(std::errc::invalid_argument), s);
0646d8a3
BK
33 std::string s1(obj.what());
34 std::string s2(obj.what());
35 VERIFY( s1 == s2 );
36}
37
38int main(void)
0bb81a93 39{
0646d8a3 40 test01();
0bb81a93
BK
41 return 0;
42}