This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/69782] [6 Regression] defining min() macro causes thousand of lines of error messages
- 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: Fri, 12 Feb 2016 11:06:08 +0000
- Subject: [Bug libstdc++/69782] [6 Regression] defining min() macro causes thousand of lines of error messages
- Auto-submitted: auto-generated
- References: <bug-69782-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69782
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2016-02-12
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is undefined behaviour, really egregious undefined behaviour.
The code compiled before because <iostream> includes <bits/c++config.h> which
does
#undef min
#undef max
to remove the silly macro before doing anything else. Now that <math.h> include
<bits/c++config.h> those #undefs come too early to help.
I assume clang does it by not having header guards in its __undef_min_max file,
so that it can be re-included by any header and redo the #undefs.
I'm almost tempted to make it #error not #warning, to teach people a lesson ;-)