Article View: gnu.gcc.bug
Article #262template - const bug
From: Jonas Nygren
Date: Wed, 05 Aug 1992 06:18
Date: Wed, 05 Aug 1992 06:18
25 lines
889 bytes
889 bytes
Here follows a template bug related to const member functions. If
'const' is removed or the definition is kept within the class
declaration everything works OK.
/jonas
template<class T> class X {
public:
int f() const;
};
template<class T> int X<T>::f() const {
return 0;
}
main(){
X<int> x;
}
gcc 2.1 and 2.2.1 complains as follows:
/u/jonas/z.cc: In function `int main ()':
/u/jonas/z.cc:5: template for method `f' doesn't match any in class `X<int>'
Technical Details
Message-ID:
<1992Aug5.061842.3278@ericsson.se>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!beppe.ericsson.SE!jonasShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!beppe.ericsson.SE!jonas From: jonas@beppe.ericsson.SE (Jonas Nygren) Subject: template - const bug Message-ID: <1992Aug5.061842.3278@ericsson.se> Sender: gnulists@ai.mit.edu Organization: Ericsson Telecom, Stockholm, Sweden Distribution: gnu Date: Wed, 5 Aug 1992 06:18:42 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 27