Gcc4Restrictions
From LucidDB Wiki
GCC 4.0 tries to adhere to the standards a bit more strictly than GCC 3.*. Here are some of the most common compatibility issues to keep in mind.
1. An explicit virtual destructor is needed when there are virtual functions in the class.
2. Strictness when using templates:
- a. Explicit instantiation of the template instances. For example,
template Test<char>; // okay in gcc 3.*, but not okay in gcc 4.0
template class Test<char>; // gcc 4.0 syntax.
- b.
class Test<char> {} ; // not okay in gcc 4.0
template <> class Test<char> {} ; // okay in gcc 4.0
- c. When using template classes, all methods and variables used should be explicitly qualified if the methods and variables are used from the super class. For example,
template <class T>
class Test : public T
{
public:
void test() {
T::func(); // okay in gcc 4.0
func(); // not okay in gcc 4.0 if func() is a method in T
// okay in gcc 3.*. Similarly strict with member
// variables of base class T
}
}