This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Sorry for recent bug-report
- To: egcs-bugs at cygnus dot com
- Subject: Sorry for recent bug-report
- From: Rich Lee <llee1 at lsc dot nd dot edu>
- Date: Wed, 1 Jul 1998 16:24:26 -0500 (EST)
Sorry for last bug-report from me. It is not the fault of template
partial specializations but because gcc and KCC use different STL.
--Rich
g++ tst.cc -o tst
Error messages:
tst.cc: In function `int main()':
tst.cc:59: type specifier omitted for parameter
tst.cc:59: parse error before `4'
tst.cc:60: request for member `print' in `c(...)', which is of non-aggregate type `A<vector<int,__default_alloc_template<false,0> >,int> ()(...)'
//source code
//tst.cc
#include <vector>
#if defined __KCC
using std::vector;
#endif
#include <iostream.h>
template < class T1, class T2>
class A {
public:
A(T1 a_, T2 b_) :
a(a_), b(b_)
{}
void print() {
cout << a << " "
<< b << endl;
}
private:
T1 a;
T2 b;
};
#if 1
template < class T2 >
class A <vector<T2>, T2> {
public:
A(vector<T2> a_, T2 b_) :
a(a_), b(b_)
{}
void print() {
cout << "It is a vector "
<< b << endl;
}
private:
vector<T2> a;
T2 b;
};
#endif
int main()
{
A<int, int> a(1, 2);
a.print();
A<char, int> b('A', 3);
b.print();
A<vector<int>, int> c(vector<int>(), 4);
c.print();
return 0;
}