Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <streambuf> |
| 11 | |
| 12 | // template <class charT, class traits = char_traits<charT> > |
| 13 | // class basic_streambuf; |
| 14 | |
| 15 | // basic_streambuf(const basic_streambuf& rhs); |
| 16 | |
| 17 | #include <streambuf> |
| 18 | #include <cassert> |
| 19 | |
Marshall Clow | 83e2c4d | 2013-01-05 03:21:01 +0000 | [diff] [blame] | 20 | #include "platform_support.h" // locale name macros |
Howard Hinnant | c0d0cba | 2011-10-03 15:23:59 +0000 | [diff] [blame] | 21 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 22 | template <class CharT> |
| 23 | struct test |
| 24 | : public std::basic_streambuf<CharT> |
| 25 | { |
| 26 | typedef std::basic_streambuf<CharT> base; |
| 27 | test() {} |
| 28 | |
| 29 | test(const test& t) |
| 30 | : std::basic_streambuf<CharT>(t) |
| 31 | { |
| 32 | assert(this->eback() == t.eback()); |
| 33 | assert(this->gptr() == t.gptr()); |
| 34 | assert(this->egptr() == t.egptr()); |
| 35 | assert(this->pbase() == t.pbase()); |
| 36 | assert(this->pptr() == t.pptr()); |
| 37 | assert(this->epptr() == t.epptr()); |
| 38 | assert(this->getloc() == t.getloc()); |
| 39 | } |
| 40 | |
| 41 | void setg(CharT* gbeg, CharT* gnext, CharT* gend) |
| 42 | { |
| 43 | base::setg(gbeg, gnext, gend); |
| 44 | } |
| 45 | void setp(CharT* pbeg, CharT* pend) |
| 46 | { |
| 47 | base::setp(pbeg, pend); |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | int main() |
| 52 | { |
| 53 | { |
| 54 | test<char> t; |
| 55 | test<char> t2 = t; |
| 56 | } |
| 57 | { |
| 58 | test<wchar_t> t; |
| 59 | test<wchar_t> t2 = t; |
| 60 | } |
| 61 | { |
| 62 | char g1, g2, g3, p1, p3; |
| 63 | test<char> t; |
| 64 | t.setg(&g1, &g2, &g3); |
| 65 | t.setp(&p1, &p3); |
| 66 | test<char> t2 = t; |
| 67 | } |
| 68 | { |
| 69 | wchar_t g1, g2, g3, p1, p3; |
| 70 | test<wchar_t> t; |
| 71 | t.setg(&g1, &g2, &g3); |
| 72 | t.setp(&p1, &p3); |
| 73 | test<wchar_t> t2 = t; |
| 74 | } |
Howard Hinnant | c0d0cba | 2011-10-03 15:23:59 +0000 | [diff] [blame] | 75 | std::locale::global(std::locale(LOCALE_en_US_UTF_8)); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 76 | { |
| 77 | test<char> t; |
| 78 | test<char> t2 = t; |
| 79 | } |
| 80 | { |
| 81 | test<wchar_t> t; |
| 82 | test<wchar_t> t2 = t; |
| 83 | } |
| 84 | } |