This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
The mentioned line generates compile error: /u/riesen/gcc-3.4-20030903/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4/bits/fstream.tcc: In member function `virtual streamsize std::basic_filebuf<_CharT, _Traits>::xsputn(const _CharT*, streamsize)': /u/riesen/gcc-3.4-20030903/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4/bits/fstream.tcc:463: error: expected unqualified-id For such code: #include <algorithm> // some header file doing #define: #define min(a,b) ((a)<(b)?(a): (b)) #include <fstream> Probably '#undef min' could be useful in every stl header, as vendors and some long-living projects seem to never catch up with the idea.
Subject: Re: New: fstream.tcc:463: error: expected unqualified-id "alexander dot riesen at synopsys dot com" <gcc-bugzilla@gcc.gnu.org> writes: | For such code: | | #include <algorithm> | // some header file doing #define: | #define min(a,b) ((a)<(b)?(a): (b)) | #include <fstream> This is not a problem in the library. The code is simply bogus. min is a reserved name. This PR should be resolved invalid. -- Gaby
Subject: Re: fstream.tcc:463: error: expected unqualified-id gdr at integrable-solutions dot net, Tue, Sep 09, 2003 12:18:32 +0200: > > | For such code: > | > | #include <algorithm> > | // some header file doing #define: > | #define min(a,b) ((a)<(b)?(a): (b)) > | #include <fstream> > > This is not a problem in the library. The code is simply bogus. > min is a reserved name. This PR should be resolved invalid. > I'm not saying the library is wrong. Of course the code _is_ bogus! The problem is, there is a lot of such code out there. If the PR is invalid, why there is "undef min" (and max) in the stl_algobase.h, line 128? Can there be any help for a sore programmer confronting the problem next time? Just a hint to help to identify the place where the macro redefines a reserved word? -alex
Subject: Re: fstream.tcc:463: error: expected unqualified-id "alexander dot riesen at synopsys dot com" <gcc-bugzilla@gcc.gnu.org> writes: | If the PR is invalid, why there is "undef min" (and max) in the | stl_algobase.h, line 128? a carry over from old days, most certainly. Probably, should go away. -- Gaby
Just as Gaby said. You can always place the #undef in your own files, in front of the #include. It's not the libraries task to clean up macro names. W.
Subject: Re: fstream.tcc:463: error: expected unqualified-id bangerth at dealii dot org, Tue, Sep 09, 2003 16:10:58 +0200: > Just as Gaby said. You can always place the #undef in your own files, > in front of the #include. It's not the libraries task to clean up > macro names. That's what I did. I'd like to get rid of the offending definition as well, it's just kind of tricky to find in the maze of headers.
Subject: Re: fstream.tcc:463: error: expected unqualified-id "alexander dot riesen at synopsys dot com" <gcc-bugzilla@gcc.gnu.org> writes: | bangerth at dealii dot org, Tue, Sep 09, 2003 16:10:58 +0200: | > Just as Gaby said. You can always place the #undef in your own files, | > in front of the #include. It's not the libraries task to clean up | > macro names. | | That's what I did. I'd like to get rid of the offending definition as well, then that is beyond the scope of V3. -- Gaby