http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49386

           Summary: #undef min/max is dependent on order if #include
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: gintensub...@gmail.com


testsuite ( bug.cc ) :

#include <iostream> // any C++ header not including <algorithm>

#define max( a, b ) bad_macro
#include <algorithm>


output:

In file included from
/usr/local/gcc47-20110604/lib/gcc/i686-pc-cygwin/4.7.0/../../../../include/c++/4.7.0/bits/stl_algo.h:62:0,
                 from
/usr/local/gcc47-20110604/lib/gcc/i686-pc-cygwin/4.7.0/../../../../include/c++/4.7.0/algorithm:63,
                 from bug.cc:4:
/usr/local/gcc47-20110604/lib/gcc/i686-pc-cygwin/4.7.0/../../../../include/c++/4.7.0/bits/algorithmfwd.h:358:41:
error: macro "max" passed 3 arguments, but takes just 2
/usr/local/gcc47-20110604/lib/gcc/i686-pc-cygwin/4.7.0/../../../../include/c++/4.7.0/bits/algorithmfwd.h:354:5:
error: template declaration of 'const _Tp& std::bad_macro'
/usr/local/gcc47-20110604/lib/gcc/i686-pc-cygwin/4.7.0/../../../../include/c++/4.7.0/bits/algorithmfwd.h:358:5:
error: template declaration of 'const _Tp& std::max'


note:

The same error occurs in case of including <limits>.

Reply via email to