home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 15938 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  2.7 KB

  1. Path: sparky!uunet!mcsun!uknet!doc.ic.ac.uk!agate!spool.mu.edu!darwin.sura.net!sgiblab!munnari.oz.au!mel.dit.csiro.au!mineng.dmpe.CSIRO.AU!dmssyd.syd.dms.CSIRO.AU!metro!otc!swdev!grahamd
  2. From: grahamd@swdev.research.otca.oz.au (Graham Dumpleton)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Template with pointer-to-member-function problem
  5. Message-ID: <6705@otc.otca.oz>
  6. Date: 7 Nov 92 23:37:09 GMT
  7. References: <1992Nov4.105723.26714@news.uni-stuttgart.de>
  8. Sender: news@otc.otca.oz
  9. Organization: Technology Development Group, OTC Australia
  10. Lines: 42
  11.  
  12. In article <1992Nov4.105723.26714@news.uni-stuttgart.de>, KOCHER@nvdv.e-technik.uni-stuttgart.dbp.de (HARTMUT KOCHER) writes:
  13. > The following code shows an excerpt of a call back template class.
  14. > It takes a reference to a class and a pointer to member function
  15. > of the same class. When I compile this code with HP cfront 3.0, I
  16. > get the following error message for the contructor call:
  17. > CC: "test.C", line 33: error: bad argument 2 type for 
  18. > CB <Test> ::CB__pt__6_4Test(): void (Test::*)() 
  19. > ( void (Test::*)() expected) (1264)
  20. > Obviously, the arguments are the same, so why is cfront complaining?
  21. > If I make a non-template class with the same functionality,
  22. > everything works as expected. Any ideas, what's going wrong here?
  23. > Is there a workaround for this? I also tried to use a typedef for
  24. > the pointer to member function, but this confuses cfront even more.
  25. > Also, if I supply 0 for the function pointer, cfront aborts with an
  26. > internal error.
  27. > What can I do? Any help would be appreciated!
  28.  
  29. If HP's compiler is indeed simply a port of AT&T's compiler then the problem
  30. is because there is a bug in AT&T C++ version 3.0.1 (3.0 as well probably).
  31. We contacted AT&T about this problem and it has been fixed for their version
  32. 3.0.2 compiler. In our playing we were not able to find any satisfactory
  33. workaround so we ending up tracking down the problem in the cfront src and
  34. fixing it ourselves.
  35.  
  36. Since you got your compiler from HP I would suggest contacting them although
  37. what help you can get will probably depend on whether you pay software
  38. maintenance. It would also depend on whether AT&T gives out fixes to
  39. particular problems.
  40.  
  41. BTW, once this problem is fixed it is not all plain sailing. In particular
  42. if you had actually made CB<T>::CallBack() inline you would have exercised
  43. another bug in cfront 3.0.1 with the result being an internal error. When we
  44. contacted AT&T they indicated that this problem had not been fixed and
  45. probably wouldn't be for version 3.0.2. However since you can quite happily
  46. make the function non-inline and have it work it isn't too serious.
  47.  
  48. Hope this helps.
  49.  
  50. -- 
  51. Graham Dumpleton (grahamd@swdev.research.otca.oz.au)
  52.