Move old test into test/libcxx, and implement new version of test for ostreambuf_iterator::failed. Fixes PR#37245. Thanks to Billy O'Neill for the bug report.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@330955 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2018-04-26 16:16:45 +00:00
parent db0ba4480a
commit a5996e8dc9
2 changed files with 47 additions and 2 deletions

View File

@@ -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.
//
//===----------------------------------------------------------------------===//
// <iterator>
// class ostreambuf_iterator
// bool failed() const throw();
//
// Extension: constructing from NULL is UB; we just make it a failed iterator
#include <iterator>
#include <sstream>
#include <cassert>
int main()
{
{
std::ostreambuf_iterator<char> i(nullptr);
assert(i.failed());
}
{
std::ostreambuf_iterator<wchar_t> i(nullptr);
assert(i.failed());
}
}