Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: gcc/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc

Issue 3050029: [gcc] GCC 4.5.0=>4.5.1 (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/nacl-toolchain.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // { dg-options "-std=gnu++0x" }
2
3 // Copyright (C) 2007, 2009
4 // Free Software Foundation, Inc.
5 //
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)
10 // any later version.
11
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.
16
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/>.
20
21 #include <string>
22 #include <system_error>
23 #include <cstring>
24 #include <testsuite_hooks.h>
25
26 // test copy ctors, assignment operators, and persistence of member string data
27 // libstdc++/1972
28 // via Greg Bumgardner <bumgard@roguewave.com>
29 void allocate_on_stack(void)
30 {
31 const size_t num = 512;
32 __extension__ char array[num];
33 for (size_t i = 0; i < num; i++)
34 array[i]=0;
35 }
36
37 void test04()
38 {
39 bool test __attribute__((unused)) = true;
40 const std::string s("CA ISO emergency once again:immediate power down");
41 const char* strlit1 = "wish I lived in Palo Alto";
42 const char* strlit2 = "...or Santa Barbara";
43 std::system_error obj1(std::error_code(), s);
44
45 // block 01
46 {
47 const std::string s2(strlit1);
48 std::system_error obj2(std::error_code(), s2);
49 obj1 = obj2;
50 }
51 allocate_on_stack();
52 VERIFY( std::strcmp(strlit1, obj1.what()) == 0 );
53
54 // block 02
55 {
56 const std::string s3(strlit2);
57 std::system_error obj3 = std::system_error(std::error_code(), s3);
58 obj1 = obj3;
59 }
60 allocate_on_stack();
61 VERIFY( std::strcmp(strlit2, obj1.what()) == 0 );
62 }
63
64 int main(void)
65 {
66 test04();
67 return 0;
68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698