home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / g / bug / 2312 < prev    next >
Encoding:
Text File  |  1993-01-23  |  2.4 KB  |  81 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!catfish.lcs.mit.edu!hacrat
  2. From: hacrat@catfish.lcs.mit.edu (Nate Osgood)
  3. Newsgroups: gnu.g++.bug
  4. Subject: 2.3.3 Template Interface Change/Bug?
  5. Date: 22 Jan 1993 21:26:22 -0500
  6. Organization: MIT Laboratory for Computer Science
  7. Lines: 68
  8. Sender: daemon@cis.ohio-state.edu
  9. Approved: bug-g++@prep.ai.mit.edu
  10. Distribution: gnu
  11. Message-ID: <1993Jan22.153806.11937@mintaka.lcs.mit.edu>
  12.  
  13. Hi!  I'm a long-time user of g++ and of the g++ template system.  I was
  14. quite surprised to find my template code responsible for many error
  15. messages when I upgraded from gcc 2.2 to 2.3.3 (running on a Sun4
  16. under SunOS 4.1.3).  I'm confident that the errors result from some
  17. simple language spec change between the two versions of the compiler,
  18. and I'm hoping to be able to modify my code accordingly.  I've
  19. condensed the problem down to a minimal example.   
  20.  
  21. The problem concerns a report that there is no constructor present for
  22. a template class in the visible scope.  It seems to occur when trying
  23. to pass instances of the template class being complained about.
  24. Here's the code:
  25.  
  26.  
  27.  
  28.  
  29.  
  30. template<class Contents> class A 
  31. {
  32.  public:
  33.  A() {}
  34.  A(A &t) {}
  35.     
  36. };
  37.  
  38.  
  39. void    bar(A<int>);
  40.  
  41. int foo()
  42. {
  43.   A<int> foo;
  44.  
  45.   bar(foo);
  46.  }
  47.  
  48.  
  49.  
  50. and here's the associatd compile
  51.  
  52. g++ -v /usr/tmp/foo.c
  53. Reading specs from /usr/uns/lib/gcc-lib/sun4/2.3.3/specs
  54. gcc version 2.3.3
  55.  /usr/uns/lib/gcc-lib/sun4/2.3.3/cpp -lang-c++ -v -iprefix /usr/uns/lib/gcc-lib/sun4/2.2.2/sun4/2.3.3/ -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix /usr/tmp/foo.c /usr/tmp/cca13992.i
  56. GNU CPP version 2.3.3 (sparc)
  57.  /usr/uns/lib/gcc-lib/sun4/2.3.3/cc1plus /usr/tmp/cca13992.i -quiet -dumpbase foo.cc -version -o /usr/tmp/cca13992.s
  58. GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
  59. /usr/tmp/foo.c: In function `int  foo ()':
  60. /usr/tmp/foo.c:16: no constructor named `A' in visible scope
  61. /usr/tmp/foo.c:17: warning: control reaches end of non-void function
  62.  
  63. Compilation exited abnormally with code 1 at Wed Jan 20 22:54:35
  64.  
  65.  
  66. -------------------
  67.  
  68.  
  69. any ideas of what i'm missing?
  70.  
  71.  
  72. thanks!
  73.  
  74. nate osgood
  75. -- 
  76. -------------------------------------------------------------------------------
  77. Nate Osgood            | ARPA: hacrat@catfish.lcs.mit.edu
  78. CS Graduate Student        | 
  79. MIT LCS Room NE43-636        | UUCP: ...!uunet!catfish.lcs.mit.edu!hacrat
  80.  
  81.