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]

preprocessor/3726: macro expansion min(a,b) conflicts with min() function



>Number:         3726
>Category:       preprocessor
>Synopsis:       macro expansion min(a,b) conflicts with min() function
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 18 04:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     thomas.hiller@sap.com
>Release:        gcc-3.0 (including 20010716)
>Organization:
>Environment:
ia64 and ia32
>Description:
When I have defined the min (and max) macro to have two arguments,
should the preprocessor also expand int min() {} ?
If yes, it conflicts with the class numeric_limits from libstdc++.
Is it no longer possible to use the min/max macros with c++ ?

This is the reason for libstdc++/3658

min() gets expanded to min and in the following the syntax become
wrong.
>How-To-Repeat:
#ifndef min
  #define min(a,b)       (((a) <= (b)) ? (a) : (b))
#endif

int min() {}

Just compile these lines. I would expect no macro argument error.
Tests on SUN with SUNcc didn't show the argument errors.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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