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

  1. Newsgroups: gnu.g++.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!me.utoronto.ca!zougas
  3. From: zougas@me.utoronto.ca (Athanasios(Tom) Zougas)
  4. Subject: compiler error 15
  5. Message-ID: <9212291723.AA01638@drill.me.utoronto.ca>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 29 Dec 1992 17:23:24 GMT
  10. Approved: bug-g++@prep.ai.mit.edu
  11. Lines: 44
  12.  
  13. I got an internal compiler error 15 with the following code:
  14.  
  15. ////////////////////////////////////////////////////////////////
  16. // test.cc
  17. ////////////////////////////////////////////////////////////////
  18. #include <iostream.h>
  19.  
  20. #include "test.h"
  21.  
  22. int _Test::x = 99;
  23. int Test<int>::x(88);        // <===this caused the error
  24. // int Test<int>::x = 88;    // <===but this was accepted
  25.  
  26. main()
  27. {
  28.   Test<int> ti;
  29.   ti.print();
  30. }
  31.  
  32. ////////////////////////////////////////////////////////////////
  33. // test.h
  34. ////////////////////////////////////////////////////////////////
  35. #include <iostream.h>
  36.  
  37. class _Test {
  38. public:
  39.   _Test() {}
  40.   void print() { cout << x << endl; }
  41.   static int x;
  42. };
  43.  
  44. template <class Type>
  45. class Test : public _Test {
  46. public:
  47.   void print() { _Test::print(); cout << x << endl; }
  48.   static int x;
  49. };
  50.  
  51.  
  52. ===========================================================================
  53. Tom Zougas                          zougas@me.utoronto.ca
  54. Engineering Mechanics and Design Laboratory               416-978-1281
  55. Dept of Mechanical Engineering, University of Toronto,      Toronto, CANADA
  56.  
  57.