<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/73302>73302</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [flang] Complex.cpp runtime unit test fails to build on NetBSD
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          brad0
      </td>
    </tr>
</table>

<pre>
    The Complex.cpp unit test fails to build on NetBSD. I don't see any issues on OpenBSD, Haiku or Solaris and I'm guessing this is Ok on FreeBSD too.

```
FAILED: tools/flang/unittests/Runtime/CMakeFiles/FlangRuntimeTests.dir/Complex.cpp.o
/usr/pkg/bin/clang++ -DFLANG_INCLUDE_TESTS=1 -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/brad/llvm-build-clang/tools/flang/unittests/Runtime -I/home/brad/llvm-brad
/flang/unittests/Runtime -I/home/brad/llvm-brad/flang/include -I/home/brad/llvm-build-clang/tools/flang/include -I/home/brad/llvm-build-clang/include -I/home/brad/llvm-brad/llvm/include -I/home/brad/llvm-brad/third-party/unittest/googletest/include -I/home/brad/llvm-brad
/third-party/unittest/googlemock/include -isystem /home/brad/llvm-brad/llvm/../mlir/include -isystem /home/brad/llvm-build-clang/tools/mlir/include -isystem /home/brad/llvm-build-clang/tools/clang/include -isystem /home/brad/llvm-brad/llvm/../clang/include -pipe -fPIC -f
no-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrou
gh -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-c
onversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion -Wcovered-switch-default -Wno-nested-anon-types -O2 -std=c++17 -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UN
DEBUG -Wno-suggest-override -MD -MT tools/flang/unittests/Runtime/CMakeFiles/FlangRuntimeTests.dir/Complex.cpp.o -MF tools/flang/unittests/Runtime/CMakeFiles/FlangRuntimeTests.dir/Complex.cpp.o.d -o tools/flang/unittests/Runtime/CMakeFiles/FlangRuntimeTests.dir/Complex.c
pp.o -c /home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:50:13: error: expected unqualified-id
static std::complex<float> cpowi(std::complex<float> base, std::int32_t exp) {
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:56:13: error: expected unqualified-id
static std::complex<double> zpowi(std::complex<double> base, std::int32_t exp) {
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:62:13: error: expected unqualified-id
static std::complex<float> cpowk(std::complex<float> base, std::int64_t exp) {
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:68:13: error: expected unqualified-id
static std::complex<double> zpowk(std::complex<double> base, std::int64_t exp) {
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:77:28: error: expected unqualified-id
      AllOf(Property(&std::complex<float>::real, FloatEq(c.real())),
 ^
/usr/include/complex.h:11:17: note: expanded from macro 'complex'
#define complex _Complex
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:78:26: error: expected unqualified-id
          Property(&std::complex<float>::imag, FloatEq(c.imag()))),
 ^
/usr/include/complex.h:11:17: note: expanded from macro 'complex'
#define complex _Complex
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:84:50: error: expected unqualified-id
  return ExplainMatchResult(AllOf(Property(&std::complex<double>::real,
 ^
/usr/include/complex.h:11:17: note: expanded from macro 'complex'
#define complex _Complex
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:86:48: error: expected unqualified-id
 Property(&std::complex<double>::imag,
 ^
/usr/include/complex.h:11:17: note: expanded from macro 'complex'
#define complex _Complex
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:100:27: error: use of undeclared identifier 'cpowi'
  EXPECT_COMPLEX_FLOAT_EQ(cpowi(3.f + 4if, 0), 1.f + 0if);
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:101:27: error: use of undeclared identifier 'cpowi'
  EXPECT_COMPLEX_FLOAT_EQ(cpowi(3.f + 4if, 1), 3.f + 4if);
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:103:27: error: use of undeclared identifier 'cpowi'
  EXPECT_COMPLEX_FLOAT_EQ(cpowi(3.f + 4if, 2), -7.f + 24if);
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:104:27: error: use of undeclared identifier 'cpowi'
  EXPECT_COMPLEX_FLOAT_EQ(cpowi(3.f + 4if, 3), -117.f + 44if);
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:105:27: error: use of undeclared identifier 'cpowi'
  EXPECT_COMPLEX_FLOAT_EQ(cpowi(3.f + 4if, 4), -527.f - 336if);
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:107:27: error: use of undeclared identifier 'cpowi'
  EXPECT_COMPLEX_FLOAT_EQ(cpowi(3.f + 4if, -2), -0.0112f - 0.0384if);
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:108:27: error: use of undeclared identifier 'cpowi'
  EXPECT_COMPLEX_FLOAT_EQ(cpowi(2.f + 1if, 10), -237.f - 3116if);
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:109:27: error: use of undeclared identifier 'cpowi'
  EXPECT_COMPLEX_FLOAT_EQ(cpowi(0.5f + 0.6if, -10), -9.322937f - 7.2984829if);

/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:111:27: error: use of undeclared identifier 'cpowi'
 EXPECT_COMPLEX_FLOAT_EQ(cpowi(2.f + 1if, 5), -38.f + 41if);
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:112:27: error: use of undeclared identifier 'cpowi'
  EXPECT_COMPLEX_FLOAT_EQ(cpowi(0.5f + 0.6if, -5), -1.121837f + 3.252915if);
 ^
/home/brad/llvm-brad/flang/unittests/Runtime/Complex.cpp:115:7: error: use of undeclared identifier 'cpowi'
      cpowi(0.f + 1if, std::numeric_limits<std::int32_t>::min()), 1.f + 0if);
      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWV1z2yoT_jXkhkEjIX9e5MK2rB7P5KNv7E5658FiJfMGgQ6gpOmvP4Mk20nbpMk5iTNTjcexlmXZ53lWgAKzVhQK4BT1p6ifnLDabbU53RjGw5ON5venqy3gmS4rCd-CrKpwrYTDDqzDORPSYqfxphaSY63wBbjpMgnwAnOtEB06bAEwU_dYWFuD9T6XFajpMkF0hv9i4qbG2uCllswIi5nieIHosMRFDdYKVWC3FRYLiy9vfOfUAEyXCXZaByhMUDjpvgdh92lu08nibJ6geOIdpUU0zSVTBaKpz94n721XtXKiBETT2Tm7gVRI8ObUu3ZtK-8acGG804GEQHfD0rS2vq268cE3QiGaZu1QU0SnmCTp2eTi03pxMTv7kszXq_lytURxEu1bzhar1dl8Pb9IFpOLruWTd1v_NVmur1arBYqTEJNkncynXz75H5_OFtPZ16_ryXI5v1otLi-W3rperpLZenZ5sVxNLlbr88ns6vJBQ3p5dT752Xy2OF8crAtE061uKPEVgGgq5W1JGn1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