Problem with templates (is this correct code?)
Tue Sep 7 18:41:00 GMT 1999

I seem to be having a problem getting my template to recognize adding a
'const' keyword to a function. Here is some much-simplified example code:

template <class classType>
class test{
        int lookup(const classType);

template <class classType>
int test<classType>::lookup(const classType)
{ return 0; }

typedef test<char *> mytest;
int main(){
        mytest *foo=new mytest();
        const char * bar="this should work, right?";
        return 0;

gives: In function `int main()': passing `const char *' as argument 1 of `test<char*>::lookup(char*)'
discards qualifiers

gcc version 2.95.1 19990816 (release)

-David Waite (not on mailing list, please reply via email)

More information about the Gcc-bugs mailing list