N
Nicolas GALAN
Hello,
I've a problem about templates which occurs on g++ and not with CC on Irix.
g++ says :
Test.cpp: In member function `void A::test()':
Test.cpp:53: error: parse error before `>' token
Versions of g++ : 2.96 and 3.3.3
CC : MIPSpro Compilers: Version 7.4
I'm beginner with template and I don't know if I'm mistaken or if g++
should compile it (CC does it).
Thanks,
Nicolas.
----------------------------------------
#include <iostream>
class B
{
public:
B();
~B();
template <class T> void action();
};
B::B()
{
}
B::~B()
{
}
template <class T>
void B::action()
{
std::cout << "B::action" << std::endl;
}
class A
{
public:
A();
~A();
template <class T> void test();
};
A::A()
{
}
A::~A()
{
}
template <class T>
void A::test()
{
std::cout << "A::test" << std::endl;
B b;
//g++ says : "parse error before `>' token"
b.action<T>();
}
int main()
{
std::cout << "main" << std::endl;
A a;
a.test<char>();
return( 0 );
}
I've a problem about templates which occurs on g++ and not with CC on Irix.
g++ says :
Test.cpp: In member function `void A::test()':
Test.cpp:53: error: parse error before `>' token
Versions of g++ : 2.96 and 3.3.3
CC : MIPSpro Compilers: Version 7.4
I'm beginner with template and I don't know if I'm mistaken or if g++
should compile it (CC does it).
Thanks,
Nicolas.
----------------------------------------
#include <iostream>
class B
{
public:
B();
~B();
template <class T> void action();
};
B::B()
{
}
B::~B()
{
}
template <class T>
void B::action()
{
std::cout << "B::action" << std::endl;
}
class A
{
public:
A();
~A();
template <class T> void test();
};
A::A()
{
}
A::~A()
{
}
template <class T>
void A::test()
{
std::cout << "A::test" << std::endl;
B b;
//g++ says : "parse error before `>' token"
b.action<T>();
}
int main()
{
std::cout << "main" << std::endl;
A a;
a.test<char>();
return( 0 );
}