xref: /llvm-project/libcxx/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf.pass.cpp (revision 2df59c50688c122bbcae7467d3eaf862c3ea3088)
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 // <ios>
10 
11 // template <class charT, class traits> class basic_ios
12 
13 // basic_streambuf<charT,traits>* rdbuf() const;
14 
15 #include <ios>
16 #include <streambuf>
17 #include <cassert>
18 
19 int main(int, char**)
20 {
21     {
22         const std::ios ios(0);
23         assert(ios.rdbuf() == 0);
24     }
25     {
26         std::streambuf* sb = (std::streambuf*)1;
27         const std::ios ios(sb);
28         assert(ios.rdbuf() == sb);
29     }
30 
31   return 0;
32 }
33