[Bug c++/23273] gcc doesn't compile the stl headers

pinskia at physics dot uc dot edu gcc-bugzilla@gcc.gnu.org
Fri Aug 26 19:33:00 GMT 2005


------- Additional Comments From pinskia at physics dot uc dot edu  2005-08-26 18:37 -------
Subject: Re:  gcc doesn't compile the stl headers

> 
> 
> ------- Additional Comments From jacob dot navia at ants dot com  2005-08-26 18:31 -------
> Subject: RE:  gcc doesn't compile the stl headers
> 
> Hi.
> 
> You sent me this message:
> 
> -----Original Message-----
> From: pinskia at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org]
> Sent: Monday, August 22, 2005 6:36 AM
> To: Jacob Navia
> Subject: [Bug c++/23273] gcc doesn't compile the stl headers
> 
> 
> 
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-22 13:35 -------
> This is not a bug.  You have a macro max which is defined and so you get:
> std::(((size())>(__n))?(size()):(__n)) which is a bug.
> 
> It is a bug in your code.
> 
> -------------------------------
> Why do we have min and max macros?
> /*
> On Linux and Solaris this isn't allowed:
> 
>   int i; float x; min(i,x);
> 
> It says that there is no instantiation of min<T,T>() that matches (int,float). Until they fix their type-resolving
> mechanism, we have to make-do with macros.
> */
> #ifndef min
> #define min(a,b)        ((a) < (b) ? (a): (b))
> #endif
> #ifndef max
> #define max(a,b)        ((a) > (b) ? (a): (b))
> #endif
> 
> OK. Now this work-around works in gcc 3.xxx but not now... sigh.
> Can you tell me if the original problem has been fixed?

The orginal problem is in your code as the standard says min/max are templates of
only one template agrument.  There is nothing which can be fixed in GCC or libstdc++
at all since your code is not valid C++.

-- Pinski


-- 


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



More information about the Gcc-bugs mailing list