This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
preprocessor/3726: macro expansion min(a,b) conflicts with min() function
- To: gcc-gnats at gcc dot gnu dot org
- Subject: preprocessor/3726: macro expansion min(a,b) conflicts with min() function
- From: thomas dot hiller at sap dot com
- Date: 18 Jul 2001 11:30:48 -0000
- Cc: wilhelm dot nuesser at sap dot com
- Reply-To: thomas dot hiller at sap dot com
>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: