The code below distilled from a test case submitted in this post fails to compile with HP aCC 3.77 and prior versions but compiles successfully with gcc 4.1.2 and EDG eccp 3.9.
$ cat t.cpp && aCC -V -c t.cpp
template <class T> struct B0 { };
template <class T> struct B1: B0<T> { };
template <class T> struct D: B1<T> { };
template <class T> struct X {
T* p;
X () { }
template <class U> X (const X<U> &p) : p (p.p) { }
};
X<volatile D<int> > x0;
X<volatile B1<int> > x1 (x0);
aCC: HP ANSI C++ B3910B A.03.77
Error 440: "t.cpp", line 8 # Cannot initialize 'volatile B1<int> *' with
'volatile D<int> *const'.
template <class U> X (const X<U> &p) : p (p.p) { }
^^^
Error 445: "t.cpp", line 1 # Cannot recover from earlier errors.
template <class T> struct B0 { };
^^^^^^^^^^^^^^^^^^^^^^^^^^
Description
The code below distilled from a test case submitted in this post fails to compile with HP aCC 3.77 and prior versions but compiles successfully with gcc 4.1.2 and EDG eccp 3.9.
$ cat t.cpp && aCC -V -c t.cpp
template <class T> struct B0 { };
template <class T> struct B1: B0<T> { };
template <class T> struct D: B1<T> { };
template <class T> struct X {
T* p;
X () { }
template <class U> X (const X<U> &p) : p (p.p) { }
};
X<volatile D<int> > x0;
X<volatile B1<int> > x1 (x0);
aCC: HP ANSI C++ B3910B A.03.77
Error 440: "t.cpp", line 8 # Cannot initialize 'volatile B1<int> *' with
'volatile D<int> *const'.
template <class U> X (const X<U> &p) : p (p.p) { }
^^^
Error 445: "t.cpp", line 1 # Cannot recover from earlier errors.
template <class T> struct B0 { };
^^^^^^^^^^^^^^^^^^^^^^^^^^
HP says "this works fine with A.03.80 with the option +hpxstd98." I've confirmed that aCC 3.77 also accepts the option and successfully compiles the code.
Martin Sebor added a comment - 10/Mar/08 07:28 PM HP says "this works fine with A.03.80 with the option +hpxstd98." I've confirmed that aCC 3.77 also accepts the option and successfully compiles the code.
We might want to consider using the option.
We might want to consider using the option.