c++/2822: gcc: template class error
jason.nerothin@emich.edu
jason.nerothin@emich.edu
Mon May 14 12:36:00 GMT 2001
>Number: 2822
>Category: c++
>Synopsis: gcc: template class error
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon May 14 12:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: compiler
>Release: gcc-2.96
>Organization:
>Environment:
linux rh 7.0
>Description:
get the following error(s):
tmplt.c: In function int main ()':
tmplt.c: request for a member 'show' in 'obj' which is of non-aggregate type 'A<B> () ()'
also for A.changenum...
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="tmplt.cpp"
Content-Disposition: inline; filename="tmplt.cpp"
#include <stdlib.h>
#include <stdio.h>
#include <iostream.h>
typedef int B;
template <class B>
class A{
public:
A();
B show();
void changenum(B newnum);
private:
B num;
};
template <class B>
A<B>::A(){
num=69;
};
template <class B>
B
A<B>::show(){
return num;
};
template <class B>
void
A<B>::changenum(B newnum){
num = newnum;
};
int main(){
A<int> obj;
cout << obj.show();
obj.changenum(33);
cout << obj.show();
return 0;
};
More information about the Gcc-bugs
mailing list