🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jonas Nygren Wed, 05 Aug 1992 06:18
template - const bug
#262
Author: Jonas Nygren
Date: Wed, 05 Aug 1992 06:18
25 lines
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>'
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads