| 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 | // <istream> |
| 10 | |
| 11 | // template <class charT, class traits = char_traits<charT> > |
| 12 | // class basic_istream; |
| 13 | |
| 14 | // basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>& |
| 15 | // (*pf)(basic_istream<charT,traits>&)); |
| 16 | |
| 17 | #include <istream> |
| 18 | #include <cassert> |
| 19 | |
| 20 | #include "test_macros.h" |
| 21 | |
| 22 | int f_called = 0; |
| 23 | |
| 24 | template <class CharT> |
| 25 | std::basic_istream<CharT>& |
| 26 | f(std::basic_istream<CharT>& is) |
| 27 | { |
| 28 | ++f_called; |
| 29 | return is; |
| 30 | } |
| 31 | |
| 32 | int main(int, char**) |
| 33 | { |
| 34 | { |
| 35 | std::istream is((std::streambuf*)0); |
| 36 | is >> f; |
| 37 | assert(f_called == 1); |
| 38 | } |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |