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

Side by Side Diff: gcc/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_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 // Copyright (C) 2003, 2009 Free Software Foundation
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
8
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
17
18 // 22.2.5.3.1 time_put members
19
20 #include <locale>
21 #include <sstream>
22 #include <ctime>
23 #include <testsuite_hooks.h>
24
25 class TP : public std::time_put<wchar_t>
26 {
27 public:
28 mutable std::string format_chars;
29
30 protected:
31 iter_type do_put(iter_type s, std::ios_base&, char_type,
32 const std::tm*, char format, char) const
33 {
34 format_chars.push_back(format);
35 return s;
36 }
37 };
38
39 // libstdc++/12439
40 // time_put::put reads past end of format string
41 void test03()
42 {
43 using namespace std;
44 bool test __attribute__((unused)) = true;
45
46 wostringstream stream;
47 time_t tt = time(NULL);
48
49 const wchar_t* fmt = L"%c";
50
51 TP tp;
52 tp.put(TP::iter_type(stream), stream, stream.fill(), localtime(&tt),
53 fmt, fmt + 1);
54 VERIFY( tp.format_chars.empty() );
55 }
56
57 int main()
58 {
59 test03();
60 return 0;
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698