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 // <iostream> 10 11 // istream cerr; 12 13 // RUN: %{build} 14 // RUN: %{exec} %t.exe 2> %t.err 15 // RUN: grep -e 'Hello World!' %t.err 16 17 #include <iostream> 18 #include <cassert> 19 20 #include "test_macros.h" 21 22 int main(int, char**) 23 { 24 25 std::cerr << "Hello World!\n"; 26 27 #ifdef _LIBCPP_HAS_NO_STDOUT 28 assert(std::cerr.tie() == NULL); 29 #else 30 assert(std::cerr.tie() == &std::cout); 31 #endif 32 assert(std::cerr.flags() & std::ios_base::unitbuf); 33 34 return 0; 35 } 36