Article View: gnu.g++.bug
Article #1181gcc2.3.3 failure with const and template
From: yb
Date: Tue, 29 Dec 1992 18:06
Date: Tue, 29 Dec 1992 18:06
28 lines
1365 bytes
1365 bytes
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)
Technical Details
Message-ID:
<9212291606.AA12737@sun4.lri.fr>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!lri.FR!ybShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!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