diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2017-07-25 21:36:06 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2017-07-25 21:36:06 +0100 |
commit | c2830789baaa2c6fd41adcc2c02a757ab59c843c (patch) | |
tree | 3c31212ec06206dca624076021ca38ab2d22dbb5 /libstdc++-v3/testsuite/27_io/basic_istream | |
parent | a74bc411bce0cdc1801574e5d2b4fa3fb143b0ee (diff) | |
download | gcc-c2830789baaa2c6fd41adcc2c02a757ab59c843c.zip gcc-c2830789baaa2c6fd41adcc2c02a757ab59c843c.tar.gz gcc-c2830789baaa2c6fd41adcc2c02a757ab59c843c.tar.bz2 |
PR libstdc++/53984 handle exceptions in basic_istream::sentry
PR libstdc++/53984
* include/bits/basic_ios.h (basic_ios::_M_setstate): Adjust comment.
* include/bits/istream.tcc (basic_istream::sentry): Handle exceptions
during construction.
* include/std/istream: Adjust comments for formatted input functions
and unformatted input functions.
* testsuite/27_io/basic_fstream/53984.cc: New.
* testsuite/27_io/basic_istream/sentry/char/53984.cc: New.
From-SVN: r250545
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/basic_istream')
-rw-r--r-- | libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/53984.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/53984.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/53984.cc new file mode 100644 index 0000000..9c08c72 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/53984.cc @@ -0,0 +1,41 @@ +// Copyright (C) 2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <streambuf> +#include <istream> +#include <testsuite_hooks.h> + +struct SB : std::streambuf +{ + virtual int_type underflow() { throw 1; } +}; + +void +test01() +{ + SB sb; + std::istream is(&sb); + int i; + is >> i; + VERIFY( is.bad() ); +} + +int +main() +{ + test01(); +} |