HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)

};
int (A::*(A::p))() = j;
Compiling this code with HP aC++ generates the following error:
Error: File DDB4270A.C, Line 7
Cannot initialize int (A::*)() with int (*)().
To successfully compile with HP C++ and HP aC++, change the initialization list in line
7 to &A::j;
class A {
public:
int i;
int j();
static int (A::*p)();
};
int (A::*(A::p))() = &A::j;
Non-constant Reference Initialization
In HP C++, if you do not initialize a non-constant reference with an lvalue, an
anachronistic warning is issued and compilation continues. In HP aC++, an error is
issued if you do not use an lvalue for a non-constant reference initialization. Use an
lvalue for the reference initialization, or define the reference as a const type.
Example:
void f(int &);
int main () {
f(3);
return 0;
}
Compiling this code with HP C++ generates the following warning:
CC: DDB04313A.C, line 4: warning: temporary used for non-const int & argument;
no changes will be propagated to actual argument (anachronism) (283)
Compiling the above code with HP aC++ generates the following error:
Future Error: File DDB04313A.C, Line 4
The initializer for a non-constant reference must be an lvalue.
Try changing int & to const int &.
To successfully compile the code with either compiler, use one of the two alternatives
shown below:
void f(const int &); // Use a constant reference.
int main () {
f(3);
return 0;
}
Or
void f(int &);
int i;
int main () {
Migration Considerations Related to Standardization 273