summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp')
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp
new file mode 100644
index 00000000000..3a10d8a70ad
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type pbackfail(int_type c = traits::eof());
+
+#include <streambuf>
+#include <cassert>
+
+int pbackfail_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+};
+
+int main()
+{
+ test t;
+ assert(t.sputbackc('A') == -1);
+}
OpenPOWER on IntegriCloud