home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16442 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.3 KB  |  67 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!spool.mu.edu!agate!doc.ic.ac.uk!daresbury!mrccrc!warwick!nott-cs!lut.ac.uk!cojm2
  3. From: J.March@lut.ac.uk
  4. Subject: Compiler Bug (AT&T 2.1) ?
  5. Message-ID: <1992Nov17.181306.8081@lut.ac.uk>
  6. Keywords: declaration constructor
  7. Reply-To: J.March@lut.ac.uk (Jonathan March)
  8. Organization: Loughborough University, UK.
  9. Date: Tue, 17 Nov 92 18:13:06 GMT
  10. Lines: 55
  11.  
  12. Consider this:
  13.  
  14.                 ______ start file.c _______
  15. class Elt
  16. {
  17. public:
  18.                 Elt(int*);
  19.                 Elt(const Elt&);
  20.                 Elt& operator=(const Elt&);
  21.                 ~Elt();
  22. };
  23.  
  24.  
  25.  
  26. class List
  27. {
  28. public:
  29.                 List();                                 
  30.                 List(const Elt&);
  31.                 List(const List&);
  32.                 List& operator=(const List&);
  33.                 ~List();
  34. };
  35.  
  36.  
  37. void main()
  38. {
  39.         List L(new int(1));
  40. }
  41.  
  42.  
  43.                 ______ end file.c _______
  44.  
  45. compiled with:
  46.  
  47.         CC +w file.c 
  48.  
  49. to give:
  50.  
  51. ld: Undefined symbol 
  52.    Elt::Elt(int*) 
  53.    List::~List()  
  54.    Elt::~Elt()   
  55.    List::List(const Elt&) 
  56. Compilation failed
  57.  
  58. Fair enough,
  59.  
  60. BUT:  Shouldn't this fail because the declaration of L doesn't match any of 
  61.         the constructors for class List?
  62.  
  63.  
  64. Jon March
  65.  
  66.  
  67.