🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1224

template problem

#1224
From: Mike_Strawbridge_x3852
Date: Fri, 20 Nov 1992 13:12
56 lines
1845 bytes
We just installed gcc-2.3.1 and libg++-2.2 on our Suns running SunOS4.1.3.

When compiling the following simple program I get the messages:

as: "/usr/tmp/cca05505.s", line 253: error: redefinition of symbol "_MX"
as: "/usr/tmp/cca05505.s", line 303: error: redefinition of symbol "_MN"

Can anyone help me? Is this a bug in gcc-2.3.1?

Thanks.

-----------------------------------------------------------------------

#include <stdlib.h>
#include <iostream.h>

template<class T>
inline T MX(T& a, T& b)
{return a > b ? a : b;}

template<class T>
inline T MN(T& a, T& b)
{return a < b ? a : b;}


main() {
int i, j, k;
float x,y,z;

x = 3.2;
y = 1.0;
i = 10;
j = 12;
 cout << "(i,j) =" << "(" << i << "," << j << ")" << "\n" ;
 cout << "(x,y) =" << "(" << x << "," << y << ")" << "\n" ;

 k = MX(i,j);
 z = MX(x,y);
 cout << "The max is " << k << "\n" ;
 cout << "The max is " << z << "\n" ;

 k = MN(i,j);
 z = MN(x,y);
 cout << "The min is " << k << "\n" ;
 cout << "The min is " << z << "\n" ;

       }


-----------------------------------------------------------------------

NAME:   Michael Strawbridge             	TELE: (301) 975-3852
USMAIL: National Institute of Standards 	ARPA: straw@cam.nist.gov
		and Technology            	UUCP: uunet!cme-durer!straw
        Rm. B-146, Bldg. 225
        Gaithersburg, MD  20899
Technical Details
Message-ID: <9907@oak.cam.nist.gov>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cam.NIst.GOV!straw

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cam.NIst.GOV!straw
From: straw@cam.NIst.GOV (Mike_Strawbridge_x3852)
Subject: template problem
Message-ID: <9907@oak.cam.nist.gov>
Followup-To: gnu.g++.bug
Sender: gnulists@ai.mit.edu
Organization: National Institute of Standards & Technology, Gaithersburg, MD
Distribution: gnu
Date: Fri, 20 Nov 1992 13:12:57 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 58