home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / g / bug / 1851 < prev    next >
Encoding:
Text File  |  1992-11-20  |  1.7 KB  |  72 lines

  1. Newsgroups: gnu.g++.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cam.NIst.GOV!straw
  3. From: straw@cam.NIst.GOV (Mike_Strawbridge_x3852)
  4. Subject: template problem
  5. Message-ID: <9907@oak.cam.nist.gov>
  6. Followup-To: gnu.g++.bug
  7. Sender: gnulists@ai.mit.edu
  8. Organization: National Institute of Standards & Technology, Gaithersburg, MD
  9. Distribution: gnu
  10. Date: Fri, 20 Nov 1992 13:12:57 GMT
  11. Approved: bug-g++@prep.ai.mit.edu
  12. Lines: 58
  13.  
  14. We just installed gcc-2.3.1 and libg++-2.2 on our Suns running SunOS4.1.3.
  15.  
  16. When compiling the following simple program I get the messages:
  17.  
  18. as: "/usr/tmp/cca05505.s", line 253: error: redefinition of symbol "_MX"
  19. as: "/usr/tmp/cca05505.s", line 303: error: redefinition of symbol "_MN"
  20.  
  21. Can anyone help me? Is this a bug in gcc-2.3.1?
  22.  
  23. Thanks.
  24.  
  25. -----------------------------------------------------------------------
  26.  
  27. #include <stdlib.h>
  28. #include <iostream.h>
  29.  
  30. template<class T>
  31. inline T MX(T& a, T& b)
  32. {return a > b ? a : b;}
  33.  
  34. template<class T>
  35. inline T MN(T& a, T& b)
  36. {return a < b ? a : b;}
  37.  
  38.  
  39. main() {
  40. int i, j, k;
  41. float x,y,z;
  42.  
  43. x = 3.2;
  44. y = 1.0;
  45. i = 10;
  46. j = 12;
  47.  cout << "(i,j) =" << "(" << i << "," << j << ")" << "\n" ;
  48.  cout << "(x,y) =" << "(" << x << "," << y << ")" << "\n" ;
  49.  
  50.  k = MX(i,j);
  51.  z = MX(x,y);
  52.  cout << "The max is " << k << "\n" ;
  53.  cout << "The max is " << z << "\n" ;
  54.  
  55.  k = MN(i,j);
  56.  z = MN(x,y);
  57.  cout << "The min is " << k << "\n" ;
  58.  cout << "The min is " << z << "\n" ;
  59.  
  60.        }
  61.  
  62.  
  63. -----------------------------------------------------------------------
  64.  
  65. NAME:   Michael Strawbridge                 TELE: (301) 975-3852
  66. USMAIL: National Institute of Standards     ARPA: straw@cam.nist.gov
  67.         and Technology                UUCP: uunet!cme-durer!straw
  68.         Rm. B-146, Bldg. 225
  69.         Gaithersburg, MD  20899
  70.  
  71.  
  72.