This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/69782] [6 Regression] defining min() macro causes thousand of lines of error messages


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 ;-)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]