]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc
1 // { dg-options "-std=gnu++0x" }
3 // Copyright (C) 2007, 2009, 2010
4 // Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
24 #include <testsuite_hooks.h>
26 // test copy ctors, assignment operators, and persistence of member string data
28 // via Greg Bumgardner <bumgard@roguewave.com>
29 void allocate_on_stack(void)
31 const size_t num
= 512;
32 __extension__
char array
[num
];
33 for (size_t i
= 0; i
< num
; i
++)
35 // Suppress unused warnings.
36 for (size_t i
= 0; i
< num
; i
++)
42 bool test
__attribute__((unused
)) = true;
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::logic_error
obj1(s
);
50 const std::string
s2(strlit1
);
51 std::logic_error
obj2(s2
);
55 VERIFY( std::strcmp(strlit1
, obj1
.what()) == 0 );
59 const std::string
s3(strlit2
);
60 std::logic_error obj3
= std::logic_error(s3
);
64 VERIFY( std::strcmp(strlit2
, obj1
.what()) == 0 );