1213700Smm// 1999-07-01 bkoz
2213700Smm
3213700Smm// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
4213700Smm// Free Software Foundation, Inc.
5207753Smm//
6207753Smm// This file is part of the GNU ISO C++ Library.  This library is free
7207753Smm// software; you can redistribute it and/or modify it under the
8207753Smm// terms of the GNU General Public License as published by the
9215187Smm// Free Software Foundation; either version 3, or (at your option)
10213700Smm// any later version.
11207753Smm
12207753Smm// This library is distributed in the hope that it will be useful,
13213700Smm// but WITHOUT ANY WARRANTY; without even the implied warranty of
14207753Smm// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15207753Smm// GNU General Public License for more details.
16207753Smm
17207753Smm// You should have received a copy of the GNU General Public License along
18207753Smm// with this library; see the file COPYING3.  If not see
19207753Smm// <http://www.gnu.org/licenses/>.
20207753Smm
21213700Smm// 21.3.7.9 inserters and extractors
22207753Smm
23207753Smm// NB: This file is predicated on sstreams, istreams, and ostreams
24207753Smm// working, not to mention other major details like char_traits, and
25207753Smm// all of the string class.
26213700Smm
27207753Smm#include <string>
28207753Smm#include <sstream>
29207753Smm#include <testsuite_hooks.h>
30207753Smm
31213700Smm// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00085.html
32213700Smm// istream::operator>>(string)
33215187Smm// sets failbit
34207753Smm// NB: this is a defect in the standard.
35213700Smmvoid test07(void)
36213700Smm{
37213700Smm  bool test __attribute__((unused)) = true;
38213700Smm  const std::wstring name(L"z6.cc");
39207753Smm  std::wistringstream iss(name);
40207753Smm  int i = 0;
41207753Smm  std::wstring s;
42207753Smm  while (iss >> s)
43207753Smm    ++i;
44207753Smm
45213700Smm  VERIFY( i < 3 );
46213700Smm  VERIFY( static_cast<bool>(iss.rdstate() & std::ios_base::failbit) );
47207753Smm}
48213700Smm
49207753Smmint main()
50207753Smm{
51207753Smm  test07();
52213700Smm  return 0;
53207753Smm}
54215187Smm