RobertsonEricW
2017-05-15 12:47:03 UTC
Did a quick google search for this bug and did not find anything. So, I am not certain everyone is aware of this bug. So I thought I would post it here to let everyone know. While I was attempting to build the current CMake on OpenVMS Alpha V8.3 (using the HP C++ V7.3-009 for OpenVMS Alpha V8.3 compiler) I came across the following build error:
49103 cmPolicies::PolicyStatus cmPolicies::PolicyMap::Get(
49104 cmPolicies::PolicyID id) const
49105 {
Source Listing 14-MAY-2017 19:42:14 HP C++ V7.3-009 Page 946
14-MAY-2017 16:13:15 [cmake-3^.8^.1.Source]cmPolicies.cxx;1
49106 PolicyStatus status = cmPolicies::WARN;
49107
49108 if (this->Status[(POLICY_STATUS_COUNT * id) + OLD]) {
..................1
%CXX-E-NOMATOPRFUN, (1) no operator "[]" matches these operands
operand types are: const std::bitset<204U> [ int ]
E if (this->Status[(3 * id) + OLD]) {
49109 status = cmPolicies::OLD;
49110 } else if (this->Status[(POLICY_STATUS_COUNT * id) + NEW]) {
.........................1
%CXX-E-NOMATOPRFUN, (1) no operator "[]" matches these operands
operand types are: const std::bitset<204U> [ int ]
E } else if (this->Status[(3 * id) + NEW]) {
49111 status = cmPolicies::NEW;
49112 }
49113 return status;
49114 }
It turns out these error are caused by the missing const form of the std::bitset<N>::operator[](size_t pos) function in the bitset C++ header file. The const form is required in the context of the above function definition for cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) because this is a const member function whose this pointer implicitly refers to a const cmPolicies::PolicyMap instance whose std::bitset<N> Status member is in turn also implicitly treated as const. Since there will be no more updates to the OpenVMS Alpha C++ Compiler I just fixed and replaced the errant bitset header file in the C++ header library SYS$LIBRARY:CXXL$ANSI_DEF.TLB. If anyone would like the fixed version just let me know and I will provide a copy of it.
49103 cmPolicies::PolicyStatus cmPolicies::PolicyMap::Get(
49104 cmPolicies::PolicyID id) const
49105 {
Source Listing 14-MAY-2017 19:42:14 HP C++ V7.3-009 Page 946
14-MAY-2017 16:13:15 [cmake-3^.8^.1.Source]cmPolicies.cxx;1
49106 PolicyStatus status = cmPolicies::WARN;
49107
49108 if (this->Status[(POLICY_STATUS_COUNT * id) + OLD]) {
..................1
%CXX-E-NOMATOPRFUN, (1) no operator "[]" matches these operands
operand types are: const std::bitset<204U> [ int ]
E if (this->Status[(3 * id) + OLD]) {
49109 status = cmPolicies::OLD;
49110 } else if (this->Status[(POLICY_STATUS_COUNT * id) + NEW]) {
.........................1
%CXX-E-NOMATOPRFUN, (1) no operator "[]" matches these operands
operand types are: const std::bitset<204U> [ int ]
E } else if (this->Status[(3 * id) + NEW]) {
49111 status = cmPolicies::NEW;
49112 }
49113 return status;
49114 }
It turns out these error are caused by the missing const form of the std::bitset<N>::operator[](size_t pos) function in the bitset C++ header file. The const form is required in the context of the above function definition for cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) because this is a const member function whose this pointer implicitly refers to a const cmPolicies::PolicyMap instance whose std::bitset<N> Status member is in turn also implicitly treated as const. Since there will be no more updates to the OpenVMS Alpha C++ Compiler I just fixed and replaced the errant bitset header file in the C++ header library SYS$LIBRARY:CXXL$ANSI_DEF.TLB. If anyone would like the fixed version just let me know and I will provide a copy of it.