X-pop3-spooler: POP3MAIL 2.1.0 b 4 980420 -bs- From: lambache AT biochem DOT mpg DOT de Date: Tue, 16 Jun 1998 13:33:18 -0400 Message-Id: <199806161733.NAA112.76@pcfr39.biochem.mpg.de> To: beastium-list AT Desk DOT nl Subject: problems with ifstream [bug?] Sender: Marc Lehmann Status: RO X-Status: A Content-Length: 2206 Lines: 88 Hello, I'm new to the list, so please forgive me, if this has been discussed before, at least I didn't find it in the FAQ. The problem: I try to use an ifstream as an argument for a function, but pgcc won't compile the code. Here is an example: ----program test.cxx----CUT HERE------ //test.cxx #include #include void test( ifstream infile ) { char line[256]; infile >> line; cout << line; } int main() { ifstream indatei("test.cxx"); test(indatei); return 0; } ----end of program-----CUT HERE--- I tried to compile this with: gcc -c test.cxx I get the following error messages: /emx/include.new/cpp/streambuf.h: In method `ifstream::ifstream(const class ifst ream &)': /emx/include.new/cpp/streambuf.h:119: `ios::ios(const class ios &)' is private test.cxx:19: within this context /emx/include.new/cpp/streambuf.h: In method `fstreambase::fstreambase(const clas s fstreambase &)': /emx/include.new/cpp/streambuf.h:119: `ios::ios(const class ios &)' is private test.cxx:19: within this context /emx/include.new/cpp/streambuf.h: In method `istream::istream(const class istrea m &)': /emx/include.new/cpp/streambuf.h:119: `ios::ios(const class ios &)' is private test.cxx:19: within this context If I compile it with gcc 2.7.2.1 (emx0.9c) it compiles and runs fine! My setup is: OS/2 Warp 4, no fixpack pgcc-version: gcc -v Using builtin specs. gcc version pgcc-2.90.27 980315 (egcs-1.0.2 release) So, is this a bug or is this correct behaviour and I'm trying something that's not allowed? I'm really interested in solving the problem, because I'm doing some numerical calculations and pgcc produces code, that is nearly twice as fast as standard gcc in my problem ! (I've lost my benchmarks of a working program, but it was a factor around 1.9) Regards Armin -- -------------------------------------------------------------------------------- Armin Lambacher email: lambache AT biochem DOT mpg DOT de "Ich sag' nicht viel, aber was ich sag' ist Quatsch." (Pippi Langstrumpf) "He, der Kerl hat 'ne Meise, aber Rueckenwind!" (thomas d) --------------------------------------------------------------------------------