home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / g / bug / 2089 < prev    next >
Encoding:
Text File  |  1992-12-29  |  3.5 KB  |  116 lines

  1. Newsgroups: gnu.g++.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!cs.cornell.edu!cliff
  3. From: cliff@cs.cornell.edu (Cliff Krumvieda)
  4. Subject: Incorrect and internal compiler errors with g++-2.3.3 on sparcs
  5. Message-ID: <9212291456.AA24335@ask.cs.cornell.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 29 Dec 1992 04:56:09 GMT
  10. Approved: bug-g++@prep.ai.mit.edu
  11. Lines: 103
  12.  
  13. Howdy:
  14.  
  15. We're running g++-2.3.3 on sparcs and SunOS 4.1.1; g++ is producing
  16. some strange output on the two programs below.
  17.  
  18. ######################################################################
  19. ######################################################################
  20.  
  21. bug.C:
  22. ======================================================================
  23. #include <stream.h>
  24.  
  25. template<class T> 
  26. class X{
  27.   T ick;
  28. public:
  29.   X(T j){ ick = j;}
  30.   X(X& x){ ick = x.ick;}
  31.   T get(){ return ick; };
  32. };
  33.  
  34. void zook ( X<char> y) {
  35.   cout << y.get() << "\n";
  36. }
  37.  
  38. main () {
  39.   X<char> xc('a');
  40.   zook(xc);
  41. }
  42. ======================================================================
  43.  
  44. Compiling yields:
  45.  
  46. ======================================================================
  47. [~/bug/samuel] gnu% g++ -v bug.C
  48. Reading specs from /usr/local/gnu/gcc-2.3.3/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/specs
  49. gcc version 2.3.3
  50.  /usr/local/gnu/gcc-2.3.3/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cpp -lang-c++ -v
  51. -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__
  52. -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix bug.C /usr/tmp/cca26400.i
  53. GNU CPP version 2.3.3 (sparc)
  54.  /usr/local/gnu/gcc-2.3.3/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cc1plus /usr/tmp/cca26400.i -quiet -dumpbase bug.cc -version -o /usr/tmp/cca26400.s
  55. GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
  56. bug.C: In function `int  main ()':
  57. bug.C:18: no constructor named `X' in visible scope
  58. [~/bug/samuel] gnu%
  59. ======================================================================
  60.  
  61. However, it appears to me that X is in line 18's scope; indeed, AT&T's
  62. CC compiler has no problem with bug.C.
  63.  
  64. ######################################################################
  65. ######################################################################
  66.  
  67. bug2.C:
  68. ======================================================================
  69. #include <stream.h>
  70.  
  71. template<class T> 
  72. class X{
  73.   T ick;
  74. public:
  75.   X(T j){ ick = j;}
  76.   X(X& x){ ick = x.ick;}
  77.   T get(){ return ick; };
  78. };
  79.  
  80. template<class T>
  81. void zook ( X y) {
  82.   cout << y.get() << "\n";
  83. }
  84.  
  85. main () {
  86.   X<char> xc('a');
  87.   zook(xc);
  88. }
  89. ======================================================================
  90.  
  91. Compiling yields:
  92.  
  93. ======================================================================
  94. [~/bug/samuel] gnu% g++ -v bug2.C
  95. Reading specs from /usr/local/gnu/gcc-2.3.3/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/specs
  96. gcc version 2.3.3
  97.  /usr/local/gnu/gcc-2.3.3/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cpp -lang-c++ -v
  98. -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__
  99. -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix bug2.C /usr/tmp/cca26411.i
  100. GNU CPP version 2.3.3 (sparc)
  101.  /usr/local/gnu/gcc-2.3.3/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cc1plus /usr/tmp/cca26411.i -quiet -dumpbase bug2.cc -version -o /usr/tmp/cca26411.s
  102. GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
  103. bug2.C:13: parse error before `)'
  104. bug2.C: In function `int  main ()':
  105. bug2.C:19: Internal compiler error.
  106. bug2.C:19: Please report this to `bug-g++@prep.ai.mit.edu'.
  107. [~/bug/samuel] gnu%
  108. ======================================================================
  109.  
  110. Thanks.
  111.  
  112.                         --Cliff Krumvieda
  113.  
  114.  
  115.  
  116.