home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 20102 < prev    next >
Encoding:
Text File  |  1993-01-28  |  950 b   |  38 lines

  1. Path: sparky!uunet!ukma!usenet.ins.cwru.edu!agate!darkstar.UCSC.EDU!dlong
  2. From: dlong@cse.ucsc.edu (Dean R. E. Long)
  3. Newsgroups: comp.lang.c++
  4. Subject: inline member function (constructor) and templates
  5. Date: 29 Jan 1993 03:04:30 GMT
  6. Organization: University of California, Santa Cruz (CE/CIS Boards)
  7. Lines: 26
  8. Distribution: world
  9. Message-ID: <1ka6ruINN6tp@darkstar.UCSC.EDU>
  10. NNTP-Posting-Host: oak.ucsc.edu
  11.  
  12. Should this piece of code work?  The non-template version does.
  13.  
  14. dl
  15.  
  16. --------
  17.  
  18. oak /tmp [118] % cat b.c
  19. template <class T>
  20. class A {
  21. public:
  22.     A(void);
  23. };
  24.  
  25. template <class T>
  26. inline A<T>::A(void) {}
  27.  
  28. int main(void)
  29. {
  30.     A<int> x;
  31. }
  32. oak /tmp [119] % /usr/local/C++3.0.1/bin/CC b.c
  33. CC  b.c:
  34. "b.c", line 8: error:   A <int >::A__pt__2_i() declared with external linkage and called before defined as inline
  35. "b.c", line 8:   error detected during the instantiation of A <int >
  36.  "b.c", line 14:         is the site of the instantiation
  37. 1 error
  38.