This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Sorry for recent bug-report



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;

}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]