home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.g++.bug
- Path: sparky!uunet!cis.ohio-state.edu!lri.FR!yb
- From: yb@lri.FR
- Subject: gcc2.3.3 failure with const and template
- Message-ID: <9212291606.AA12737@sun4.lri.fr>
- Sender: gnulists@ai.mit.edu
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Tue, 29 Dec 1992 18:06:47 GMT
- Approved: bug-g++@prep.ai.mit.edu
- Lines: 29
-
- gcc2.3.3 gives incorrect error messages when calling a private constant method
- from a public method in a template class.
-
- Here is the source code and gcc diagnostics :
- ---------- file unallowed-private-call-in-template.cc ---------------------
- template <class T> class A {
- public:
- void foo ();
- private:
- void bar () const;
- };
-
- template <class T> void A<T> :: foo () { bar(); }
- template <class T> void A<T> :: bar () const {}
-
- A<int> a;
- ----------------------------------------------------------------------------
- % gcc -v
- Reading specs from /usr/local/gnu/lib/gcc-lib/hp700-hpux/2.3.3/specs
- gcc version 2.3.3
- % gcc -c unallowed-private-call-in-template.cc
- unallowed-private-call-in-template.cc: In method `void A<int>::foo ()':
- unallowed-private-call-in-template.cc:9: the method void A<int>::bar ()const is private
- unallowed-private-call-in-template.cc:8: within this context
-
- The bug disappears when I remove "private" or "const".
-
- - Yves Berteaud (yb@lri.lri.fr)
-
-