Search code examples
c++ibm-midrange

_VACPP_HASH_FUNCTION_CHECK error while trying to compile C++ code with LANGLVL(*EXTENDED0X) at IBMi7.4


I'm trying to compile simple C++ program with unordered_map using LANGLVL(*EXTENDED0X) at pub400.com:

#include <stdlib.h>
#include <stdio.h>
#include <unordered_map>
#include <string>

int main(int argc, char* argv[])
{
  printf("Hello world!\n");
  std::tr1::unordered_map<long long, std::string> test;
  test[123] = std::string("123");


  return 0;
}    

but it fails with the message:

"QSYSINC/STD(xhashtbl)", line 530.50: CZP0274(30) The name lookup for  "_VACPP_HASH_FUNCTION_CHECK" did not find a declaration.              
"QSYSINC/STD(xhashtbl)", line 530.50: CZP1226(0) Declarations for      non-dependent names are resolved in the template definition.          
"QSYSINC/STD(xhashtbl)", line 530.50: CZP1227(0)                       "_VACPP_HASH_FUNCTION_CHECK" does not depend on a template argument.  The compilation failed.

Googled the same problem with IBM AIX C++ compiler back in 2016 (it was a compiler bug). DSPJOB OUTPUT(*PRINT) show that pub400.com runs latest IBM i 7.4.

Is it compiler bug or I'm missing something? I have the same problem with IBM i 7.3 TR9 at my office. Any ideas?

Thanks.


Solution

  • It's an internal error in their /QIBM/include/std/xhashtbl, you could actually fix it yourself, you just need to exclude the whole _HashFunctionCheck function via ifdef check regarding _VACPP_HASH_FUNCTION_CHECK. They fixed it on zOS (or AIX?) a long time ago but forgot to port it for IBM i.