//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // class ostreambuf_iterator // bool failed() const throw(); #include #include #include #include "test_macros.h" template > struct my_streambuf : public std::basic_streambuf { typedef typename std::basic_streambuf::int_type int_type; typedef typename std::basic_streambuf::char_type char_type; my_streambuf() {} int_type sputc(char_type) { return Traits::eof(); } }; int main(int, char**) { { my_streambuf buf; std::ostreambuf_iterator i(&buf); i = 'a'; assert(i.failed()); } { my_streambuf buf; std::ostreambuf_iterator i(&buf); i = L'a'; assert(i.failed()); } return 0; }