[HP aCC 3.73] bogus error on static_cast initializing a const object in template code -------------------------------------------------------------------------------------
Key: STDCXX-1021 URL: https://issues.apache.org/jira/browse/STDCXX-1021 Project: C++ Standard Library Issue Type: Bug Components: External Environment: HP aCC 3.73 Reporter: Martin Sebor The following test case reproduces a compiler bug discussed in this [thread|http://markmail.org/message/b2hvtexqkgpzgddt]: {noformat} $ cat z.cpp && aCC -V z.cpp struct S { int *x; int& operator* () const { return *x; } }; template <class T> void foo (T x) { volatile void* const p = static_cast<volatile void*>(&*x); } int main () { foo (S ()); } aCC: HP ANSI C++ B3910B A.03.73 Error 746: "z.cpp", line 7 # Cannot use static_cast to convert struct S to volatile void *. volatile void* const p = static_cast<volatile void*>(&*x); ^ Error 556: "z.cpp", line 11 # Unable to generate specialization "void foo<S>(S)" due to errors during generation. foo (S ()); ^^^^^^^^^^ Error 556: "z.cpp", line 11 # Unable to generate specialization "void foo<S>(S)" due to errors during generation. foo (S ()); ^^^^^^^^^^ {noformat} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.