* a problem about gcc-3.2?
@ 2002-09-10 1:00 zsf00
0 siblings, 0 replies; 2+ messages in thread
From: zsf00 @ 2002-09-10 1:00 UTC (permalink / raw)
To: gcc
hello,
The follow codes compile well with egcs++,g++-2.96 and icc.
But can't compile with g++-3.2
#include <fstream>
#include <iostream>
using namespace std;
class FileStream : public fstream {
public:
bool isOpen() const;
};
inline bool FileStream :: isOpen() const {
return fstream::is_open(); //line 78
}
int main()
{
FileStream myFileStream;
cout << myFileStream.isOpen() << endl;
}
g++-3.2 -o test6 test6.cpp
test6.cpp: In member function `bool FileStream::isOpen() const':
test6.cpp:12: passing `const std::basic_fstream<char, std::char_traits<char> >'
as `this' argument of `bool std::basic_fstream<_CharT, _Traits>::is_open()
[with _CharT = char, _Traits = std::char_traits<char>]' discards qualifiers
Is it a bug of gcc-3.2?
Best Regards,
Shaofeng Zhang
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: a problem about gcc-3.2?
@ 2002-09-10 10:00 Benjamin Kosnik
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Kosnik @ 2002-09-10 10:00 UTC (permalink / raw)
To: gcc; +Cc: zsf00
See library defect 72.
73. is_open should be const
Section: 27.8.1 [lib.fstreams] Status: NAD Submitter: Matt Austern
Date: 27 Aug 1998
Classes basic_ifstream, basic_ofstream, and basic_fstream all have a
member function is_open. It should be a const member function, since it
does nothing but call one of basic_filebuf's const member functions.
Proposed resolution:
Rationale:
Not a defect. This is a deliberate feature; const streams would be
meaningless.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-09-10 17:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-10 1:00 a problem about gcc-3.2? zsf00
2002-09-10 10:00 Benjamin Kosnik
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).