User's Guide
CC: "DDB4325.C", line 3: error: T of type any redeclared as struct
(1479)
This code compiles without error with HP aC++.
Base Template Class Reference Syntax Change
In HP C++, you can reference a member of a base template class without qualifying the member.
In HP aC++, when you reference a member of a base template class, you must qualify the member
by adding this->.
Adding this-> defers name resolution until instantiation. This allows the compiler to find members
in template base classes. However, it prevents the compiler from finding names declared in enclosing
scopes.
Example:
template class BaseT {
public:
T t;
int i;
};
template class DerivedT : public BaseT {
public:
void foo1 () { t = 1; i = 1; } // warning 721
// t and i could be global.
void foo2 () { this->t = 2; this->i = 2; } // Correct syntax, no warning.
};
DerivedT d; // Here is the point of instantiation.
Tokens after #endif
In HP C++, any character that follows the #endif preprocessor statement causes a warning and
is ignored. In HP aC++, characters following the #endif preprocessor statement cause an error
and the program does not compile. To change this, remove all characters following all #endif
preprocessor statements or put the token in comments.
Example:
Compiling the following code with HP C++ causes a warning. Compiling with HP aC++ generates
an error.
int main(){
#ifdef FLAG
int i;
i=1;
#endif FLAG
}
To compile with HP aC++, change the code to:
int main(){
#ifdef FLAG
int i;
i=1;
#endif //FLAG
}
overload not a Keyword
In HP C++, using the overload keyword to specify a function as an overloaded function causes
an anachronistic warning and is ignored. In HP aC++, using the overload keyword causes an
error and the program does not compile. To change this, remove all occurrences of the overload
keyword.
Example:
Migration Considerations Related to Standardization 213