Possible bug in nvc++ 23.05

When compiling Eigen (stable version 3.4.0) with nvc++ I obtain the following error:

src/Core/arch/NEON/Complex.h", line 397: error: statement expressions are only allowed in block scope
    static uint64x2_t p2ul_CONJ_XOR = vld1q_u64( p2ul_conj_XOR_DATA );

The relevant code block is this:

// See bug 1325, clang fails to call vld1q_u64.
#if EIGEN_COMP_CLANG || EIGEN_COMP_CASTXML
  static uint64x2_t p2ul_CONJ_XOR = {0x0, 0x8000000000000000};
#else
  const uint64_t  p2ul_conj_XOR_DATA[] = { 0x0, 0x8000000000000000 };
  static uint64x2_t p2ul_CONJ_XOR = vld1q_u64( p2ul_conj_XOR_DATA );
#endif

Interestingly, if I force nvc++ to use the if branch the code compiles fine

// See bug 1325, clang fails to call vld1q_u64.
#if EIGEN_COMP_CLANG || EIGEN_COMP_CASTXML || __NVCOMPILER_LLVM__
  static uint64x2_t p2ul_CONJ_XOR = {0x0, 0x8000000000000000};
#else
  const uint64_t  p2ul_conj_XOR_DATA[] = { 0x0, 0x8000000000000000 };
  static uint64x2_t p2ul_CONJ_XOR = vld1q_u64( p2ul_conj_XOR_DATA );
#endif

The problem here is that the ARM NEON “vld1q_u64” intrinsic will expand into a statement so can’t be used in block scope. Similar issue occurs with Clang, and why they added the version for clang. See: https://eigen.tuxfamily.org/bz/show_bug.cgi?id=1325

So your solution of adding __NVCOMPILER_LLVM__ is correct.