This is the mail archive of the gcc@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]

Re: Is this template problem in ecgs?



On 24 Jun 1998, Alexandre Oliva wrote:

> Nicholas Lee <nlee011@math.auckland.ac.nz> writes:
> 
> > template<typename T>
> > inline T& min(const T& x, const T& y) { return (x<y)? x:y; }
> 
> Not a template problem, actually.  It would also compile if you
> replaced `template<typename T>' with `typedef int T;'.  It seems that
> gcc disregards CV-qualification if the return value is a ?:
> expression, but I haven't investigated the problem very much.

What is the correct behaviour?  

I would assume since x and y are declared as const T&, that the compiler
should issue a warning that there was a attempt to discard constness without
a const_cast.


--
	"I reserve the right to contradict myself."

Nicholas Lee (Li Peng Ming)  n.lee with math.auckland.ac in nz
Auckland University, New Zealand	



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