pending/6605: <deriving a class from std::fstream in a namespace>

mpiter@lpl.univ-aix.fr mpiter@lpl.univ-aix.fr
Wed May 8 07:36:00 GMT 2002


Hi,

I used gccbug to fill a template and send a bug report, but it came
back with a failure to reach the email address provided by gccbug.  I
therefore send the template to you.

>Number:         6605
>Category:       pending
>Synopsis:       <deriving a class from std::fstream in a namespace>
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 08 04:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Michel Pitermann
>Release:        3.0.4
>Organization:
<INRIA Lorraine, France>
>Environment:
System: Linux eglantier 2.4.7-10enterprise #1 SMP Thu Sep 6 16:48:20 EDT 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.0.4/configure --prefix=/home/mpiter/softwares/gcc-3.0.4 --with-stabs
>Description:
	<G++ fails to compile this simple code:

		#include <iostream>
		#include <fstream>
		namespace PIO {
			class Tmp_file;
		}
		class PIO::Tmp_file : public std::fstream {};

with the command line "g++ -Wall aa.cc -c".  The output is:

		/home/mpiter/bin/../include/g++-v3/bits/std_streambuf.h: In instantiation of `std::basic_streambuf<char, std::char_traits<char> >':
		/home/mpiter/bin/../include/g++-v3/bits/std_fstream.h:368:   instantiated from `std::basic_filebuf<char, std::char_traits<char> >'
		/home/mpiter/bin/../include/g++-v3/bits/std_fstream.h:368:   instantiated from `std::basic_fstream<char, std::char_traits<char> >'
		aa.cc:8:   instantiated from here
		/home/mpiter/bin/../include/g++-v3/bits/std_streambuf.h:77: `__copy_streambufs' 
			 was not declared in this scope

It seems a header file problem.

>How-To-Repeat:
	<Just recompile the code>
>Fix:
	<Put the object definition inside the template: 

  namespace PIO { class Tmp_file : public std::fstream {}; }

althout g++ fails to compile the code if we qualifies the class in the
namespace:

  namespace PIO { class PIO::Tmp_file : public std::fstream {};

cannot be compiled.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list