public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/4523: regression: struct in namespace containing an ifstream defined outside
@ 2001-10-20 21:20 rodrigc
  0 siblings, 0 replies; 2+ messages in thread
From: rodrigc @ 2001-10-20 21:20 UTC (permalink / raw)
  To: benko, gcc-bugs, gcc-prs, nobody

Synopsis: regression: struct in namespace containing an ifstream defined outside

State-Changed-From-To: open->closed
State-Changed-By: rodrigc
State-Changed-When: Sat Oct 20 21:20:08 2001
State-Changed-Why:
    Closed at the request of submitter.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4523&database=gcc


^ permalink raw reply	[flat|nested] 2+ messages in thread

* libstdc++/4523: regression: struct in namespace containing an ifstream defined outside
@ 2001-10-10  9:26 benko
  0 siblings, 0 replies; 2+ messages in thread
From: benko @ 2001-10-10  9:26 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4523
>Category:       libstdc++
>Synopsis:       regression: struct in namespace containing an ifstream defined outside
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 10 09:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Pal Benko
>Release:        3.0.1
>Organization:
>Environment:
SuSE 7.1, linux 2.4.6, i686
>Description:
Perhaps this is a c++ bug.  Compiling the following:

---------------------------------------------------->8
#include <fstream>

namespace w
{
  struct a;
}

struct w::a
{
  std::ifstream i_;
};
----------------------------------------------------->8

Gives the following error messages:

arta:~/c/proba$ /gml/shared/gcc-3.0.1/bin/g++ -c fstream_test.cc 
/gml/shared/gcc-3.0.1/include/g++-v3/bits/std_streambuf.h: In instantiation of `std::basic_streambuf<char, std::char_traits<char> >':
/gml/shared/gcc-3.0.1/include/g++-v3/bits/std_fstream.h:245:   instantiated from `std::basic_filebuf<char, std::char_traits<char> >'
/gml/shared/gcc-3.0.1/include/g++-v3/bits/std_fstream.h:245:   instantiated from `std::basic_ifstream<char, std::char_traits<char> >'
fstream_test.cc:10:   instantiated from here
/gml/shared/gcc-3.0.1/include/g++-v3/bits/std_streambuf.h:77: `__copy_streambufs'
   was not declared in this scope

2.95.3 compiles this OK.  Precompiling this with 2.95.3
and compiling the resulting code with 3.0.1 gives

arta:~/c/proba$ /gml/shared/gcc-2.95.3/bin/g++ -E -o fstream_test.ii fstream_test.cc 
arta:~/c/proba$ /gml/shared/gcc-3.0.1/bin/g++ -c fstream_test.ii
fstream_test.cc:10: ISO C++ forbids declaration of `ifstream' with no type
fstream_test.cc:10: invalid use of `::'
fstream_test.cc:10: parse error before `;' token

If the "std::" is removed, then compilation works.

Precompiling with 3.0.1 and compiling with 2.95.3 gives lots of errors,
but obviously because of libstdc++-3.



Workaround:

--------------------------------------------------->8
#include <fstream>

namespace w
{
  struct a
  {
    mutable std::ifstream i_;
  };
}
----------------------------------------------------->8
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-10-20 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-20 21:20 libstdc++/4523: regression: struct in namespace containing an ifstream defined outside rodrigc
  -- strict thread matches above, loose matches on Subject: below --
2001-10-10  9:26 benko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).