This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/82417] Macros from <complex.h> defined in C++11
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Oct 2017 16:06:29 +0000
- Subject: [Bug libstdc++/82417] Macros from <complex.h> defined in C++11
- Auto-submitted: auto-generated
- References: <bug-82417-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82417
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thinking about this further, I think we must not include <complex.h> at all for
strict -std=c++1* modes, because users could have defined their own macros with
those names, but the C header #undefs them and then redefines them with
different meaning:
#define I 1
#define imaginary imag
#include <complex.h>
std::complex<double> n{0, I};
double zero = n.imaginary();
This explodes horribly.
We can't just #undef the names after including <complex.h> because the user
macros will already have been trashed by then.