]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc
1 // 2001-02-26 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2001-2018 Free Software Foundation, Inc.
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
8 // Free Software Foundation; either version 3, or (at your option)
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.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 // 19.1 Exception classes
25 #include <testsuite_hooks.h>
27 // test copy ctors, assignment operators, and persistence of member string data
29 // via Greg Bumgardner <bumgard@roguewave.com>
30 void allocate_on_stack(void)
32 const size_t num
= 512;
33 __extension__
char array
[num
];
34 for (size_t i
= 0; i
< num
; i
++)
36 // Suppress unused warnings.
37 for (size_t i
= 0; i
< num
; i
++)
43 const std::string
s("CA ISO emergency once again:immediate power down");
44 const char* strlit1
= "wish I lived in Palo Alto";
45 const char* strlit2
= "...or Santa Barbara";
46 std::runtime_error
obj1(s
);
50 const std::string
s2(strlit1
);
51 std::runtime_error
obj2(s2
);
55 VERIFY( std::strcmp(strlit1
, obj1
.what()) == 0 );
59 const std::string
s3(strlit2
);
60 std::runtime_error obj3
= std::runtime_error(s3
);
64 VERIFY( std::strcmp(strlit2
, obj1
.what()) == 0 );