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

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!gumby!wupost!cs.uiuc.edu!sparc0b!pjl
  3. From: pjl@cs.uiuc.edu (Paul Lucas)
  4. Subject: Re: Compiler Bug (AT&T 2.1) ?
  5. Message-ID: <BxvtFL.CnL@cs.uiuc.edu>
  6. Keywords: declaration constructor
  7. Sender: news@cs.uiuc.edu
  8. Organization: University of Illinois at Urbana-Champaign
  9. References: <1992Nov17.181306.8081@lut.ac.uk>
  10. Date: Tue, 17 Nov 1992 22:35:45 GMT
  11. Lines: 59
  12.  
  13. In <1992Nov17.181306.8081@lut.ac.uk> J.March@lut.ac.uk writes:
  14.  
  15. >Consider this:
  16.  
  17. >                ______ start file.c _______
  18. >class Elt
  19. >{
  20. >public:
  21. >                Elt(int*);
  22. >                Elt(const Elt&);
  23. >                Elt& operator=(const Elt&);
  24. >                ~Elt();
  25. >};
  26.  
  27.  
  28.  
  29. >class List
  30. >{
  31. >public:
  32. >                List();                                 
  33. >                List(const Elt&);
  34. >                List(const List&);
  35. >                List& operator=(const List&);
  36. >                ~List();
  37. >};
  38.  
  39.  
  40. >void main()
  41. >{
  42. >        List L(new int(1));
  43. >}
  44.  
  45.  
  46. >                ______ end file.c _______
  47.  
  48. >compiled with:
  49.  
  50. >        CC +w file.c 
  51.  
  52. >to give:
  53.  
  54. >ld: Undefined symbol 
  55. >   Elt::Elt(int*) 
  56. >   List::~List()  
  57. >   Elt::~Elt()   
  58. >   List::List(const Elt&) 
  59. >Compilation failed
  60.  
  61. >Fair enough,
  62.  
  63. >BUT:  Shouldn't this fail because the declaration of L doesn't match any of 
  64. >        the constructors for class List?
  65.  
  66.  
  67. *****>    But List knows it can make an Elt const& from an int*, so "no."
  68. -- 
  69.     - Paul J. Lucas                University of Illinois    
  70.       AT&T Bell Laboratories        at Urbana-Champaign
  71.       Naperville, IL            pjl@cs.uiuc.edu
  72.