Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBM xlclang++ cannot build Catch v2.x #2154

Closed
datalogics-robb opened this issue Jan 19, 2021 · 1 comment
Closed

IBM xlclang++ cannot build Catch v2.x #2154

datalogics-robb opened this issue Jan 19, 2021 · 1 comment

Comments

@datalogics-robb
Copy link
Contributor

Describe the bug
IBM has nearly complete support for C++11 in 16.1.0 with the xlclang++ front-end, but is tripped up by what it considers to be an ambiguous call to std::abs

Reproduction steps
Build on AIX with xlclang++ using catch2 header <catch2/catch.hpp> (i.e. build catch2 tests with CMake)

Platform information:

  • OS: AIX 7.1
  • Compiler+version: XLC 16.1.0.1
  • Catch version: v2.13.4

Additional context
With a patch to add a static_cast<> to the argument to std::abs Catch2 build

[ 50%] Building CXX object source_subfolder/CMakeFiles/Catch2WithMain.dir/src/catch_with_main.cpp.o
cd /home/robb/.conan/data/catch2/2.13.4/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/build_subfolder/source_subfolder && /opt/IBM/xlC/16.1.0/bin/xlclang++ -x c++  -I/home/robb/.conan/data/catch2/2.13.4/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source_subfolder/single_include -qarch=pwr8 -qaltivec -qtls=global-dynamic -qpic=large   -O  -std=gnu++11 -o CMakeFiles/Catch2WithMain.dir/src/catch_with_main.cpp.o -c /home/robb/.conan/data/catch2/2.13.4/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source_subfolder/src/catch_with_main.cpp
In file included from /home/robb/.conan/data/catch2/2.13.4/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source_subfolder/src/catch_with_main.cpp:2:
/home/robb/.conan/data/catch2/2.13.4/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source_subfolder/single_include/catch2/catch.hpp:11450:24: error: 
      call to 'abs' is ambiguous
        auto ulpDiff = std::abs(lc - rc);
                       ^~~~~~~~
/home/robb/.conan/data/catch2/2.13.4/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source_subfolder/single_include/catch2/catch.hpp:11535:20: note: 
      in instantiation of function template specialization 'Catch::(anonymous namespace)::almostEqualUlps<double>' requested here
            return almostEqualUlps<double>(matchee, m_target, m_ulps);
                   ^
/opt/IBM/xlC/16.1.0/include2/aix/stdlib.h:851:18: note: candidate function
      inline int abs (int __n) { return __abs(__n);}
                 ^
/opt/IBM/xlC/16.1.0/include2/c++/math.h:733:1: note: candidate function
abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
^
/opt/IBM/xlC/16.1.0/include2/c++/math.h:737:1: note: candidate function
abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
^
/opt/IBM/xlC/16.1.0/include2/c++/math.h:741:1: note: candidate function
abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
^
1 error generated.
Error while processing /home/robb/.conan/data/catch2/2.13.4/_/_/build/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source_subfolder/src/catch_with_main.cpp.
gmake[2]: *** [source_subfolder/CMakeFiles/Catch2WithMain.dir/build.make:82: source_subfolder/CMakeFiles/Catch2WithMain.dir/src/catch_with_main.cpp.o] Error 1
@horenmar
Copy link
Member

Merged the related PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants