mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 12:02:36 +08:00
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:
32
test/libcxx/iterators/failed.pass.cpp
Normal file
32
test/libcxx/iterators/failed.pass.cpp
Normal 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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user