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

  1. Newsgroups: gnu.g++.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!lri.FR!yb
  3. From: yb@lri.FR
  4. Subject: gcc2.3.3 failure with const and template
  5. Message-ID: <9212291606.AA12737@sun4.lri.fr>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 29 Dec 1992 18:06:47 GMT
  10. Approved: bug-g++@prep.ai.mit.edu
  11. Lines: 29
  12.  
  13. gcc2.3.3 gives incorrect error messages when calling a private constant method
  14. from a public method in a template class.
  15.  
  16. Here is the source code and gcc diagnostics :
  17. ---------- file unallowed-private-call-in-template.cc ---------------------
  18. template <class T> class A {
  19. public:
  20.         void foo ();
  21. private:
  22.         void bar () const;
  23. };
  24.  
  25. template <class T> void A<T> :: foo () { bar(); }
  26. template <class T> void A<T> :: bar () const {}
  27.  
  28. A<int> a;
  29. ----------------------------------------------------------------------------
  30. % gcc -v
  31. Reading specs from /usr/local/gnu/lib/gcc-lib/hp700-hpux/2.3.3/specs
  32. gcc version 2.3.3
  33. % gcc -c unallowed-private-call-in-template.cc
  34. unallowed-private-call-in-template.cc: In method `void  A<int>::foo ()':
  35. unallowed-private-call-in-template.cc:9: the method void  A<int>::bar ()const  is private
  36. unallowed-private-call-in-template.cc:8: within this context
  37.  
  38. The bug disappears when I remove "private" or "const".
  39.  
  40. - Yves Berteaud  (yb@lri.lri.fr)
  41.  
  42.