This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/54112] including complex.h and complex fails in C++03
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 28 Jul 2012 10:26:42 +0000
- Subject: [Bug libstdc++/54112] including complex.h and complex fails in C++03
- Auto-submitted: auto-generated
- References: <bug-54112-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54112
--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> 2012-07-28 10:26:42 UTC ---
(In reply to comment #1)
> Why it happens only in C++03 mode?
Because the complex.h wrapper distributed with libstdc++ does:
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# include <ccomplex>
#else
# if _GLIBCXX_HAVE_COMPLEX_H
# include_next <complex.h>
# endif
#endif
That's what I meant by "hijack", the system's complex.h can never be included
in C++11.
> I'm asking because if the issue isn't a
> regression and we are sure that it doesn't happen in C++11 mode, I don't think
> it can be considered high priority.
I am not saying it is high priority (on the other hand, it is rather easy).
Note that there are 2 issues (I should have been clearer):
1) we can't include both complex.h and complex in C++03 mode. The fix is
trivial, #undef complex after the #include_next quoted above. The other headers
all have a long list of #undef, that's just one more.
2) In C++11, there is no way to have cacos declared. A solution would be to
move the _GLIBCXX_HAVE_COMPLEX_H block outside of the
__GXX_EXPERIMENTAL_CXX0X__ condition.