1234353Sdim// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com> 2193323Sed 3193323Sed// Copyright (C) 2001-2015 Free Software Foundation, Inc. 4193323Sed// 5193323Sed// This file is part of the GNU ISO C++ Library. This library is free 6193323Sed// software; you can redistribute it and/or modify it under the 7193323Sed// terms of the GNU General Public License as published by the 8193323Sed// Free Software Foundation; either version 3, or (at your option) 9193323Sed// any later version. 10193323Sed 11193323Sed// This library is distributed in the hope that it will be useful, 12193323Sed// but WITHOUT ANY WARRANTY; without even the implied warranty of 13193323Sed// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14193323Sed// GNU General Public License for more details. 15249423Sdim 16193323Sed// You should have received a copy of the GNU General Public License along 17249423Sdim// with this library; see the file COPYING3. If not see 18249423Sdim// <http://www.gnu.org/licenses/>. 19198090Srdivacky 20193323Sed// 27.8.1.4 Overridden virtual functions 21193323Sed 22193323Sed// { dg-require-fileio "" } 23193323Sed 24204642Srdivacky#include <fstream> 25193323Sed#include <testsuite_hooks.h> 26193323Sed 27193323Sedclass testbuf : public std::filebuf 28249423Sdim{ 29276479Sdimpublic: 30249423Sdim 31249423Sdim // Typedefs: 32249423Sdim typedef std::filebuf base_type; 33249423Sdim typedef base_type::traits_type traits_type; 34249423Sdim typedef base_type::char_type char_type; 35193323Sed 36198090Srdivacky testbuf(): base_type() 37198090Srdivacky { _M_mode = (std::ios_base::in | std::ios_base::out); } 38251662Sdim 39251662Sdim bool 40193323Sed check_pointers() 41193323Sed { 42276479Sdim bool test __attribute__((unused)) = true; 43276479Sdim test = (!this->pbase()); 44193323Sed test &= (!this->pptr()); 45219077Sdim return test; 46193323Sed } 47219077Sdim}; 48193323Sed 49193323Sedconst char name_01[] = "filebuf_virtuals-1.txt"; 50193323Sed 51193323Sed// Test overloaded virtual functions. 52193323Sedvoid test05() 53276479Sdim{ 54193323Sed using namespace std; 55193323Sed typedef std::filebuf::int_type int_type; 56198090Srdivacky typedef std::filebuf::traits_type traits_type; 57198090Srdivacky typedef std::filebuf::pos_type pos_type; 58204961Srdivacky typedef std::filebuf::off_type off_type; 59204961Srdivacky typedef size_t size_type; 60204961Srdivacky 61249423Sdim bool test __attribute__((unused)) = true; 62204642Srdivacky 63204642Srdivacky { 64276479Sdim testbuf f_tmp; 65276479Sdim 66261991Sdim // setbuf 67276479Sdim // pubsetbuf(char_type* s, streamsize n) 68193323Sed f_tmp.pubsetbuf(0,0); 69193323Sed VERIFY( f_tmp.check_pointers() ); 70193323Sed } 71276479Sdim 72276479Sdim { 73276479Sdim testbuf f_tmp; 74193323Sed 75193323Sed f_tmp.open(name_01, ios_base::out | ios_base::in); 76239462Sdim f_tmp.sbumpc(); 77193323Sed 78193323Sed // setbuf 79193323Sed // pubsetbuf(char_type* s, streamsize n) 80193323Sed f_tmp.pubsetbuf(0, 0); 81193323Sed VERIFY( f_tmp.check_pointers() ); 82193323Sed } 83193323Sed} 84193323Sed 85193323Sedint main() 86261991Sdim{ 87193323Sed test05(); 88193323Sed return 0; 89193323Sed} 90226633Sdim