1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <iterator> 10 11 // class ostreambuf_iterator 12 13 // bool failed() const throw(); 14 // 15 // Extension: constructing from NULL is UB; we just make it a failed iterator 16 17 #include <iterator> 18 #include <cassert> 19 20 #include "test_macros.h" 21 main(int,char **)22int main(int, char**) 23 { 24 { 25 std::ostreambuf_iterator<char> i(nullptr); 26 assert(i.failed()); 27 } 28 #ifndef TEST_HAS_NO_WIDE_CHARACTERS 29 { 30 std::ostreambuf_iterator<wchar_t> i(nullptr); 31 assert(i.failed()); 32 } 33 #endif 34 35 return 0; 36 } 37