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