Catch2
Catch2 copied to clipboard
Unable to compile Catch2 version 3.x.x using Intel 2019 compiler
Describe the bug
Compiling Catch devel, 3.1.0, and 3.1.0 using the intel 2019 compiler:
$ icpc --version
icpc (ICC) 19.0.5.281 20190815
Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
yields the following error:
/hpnobackup2/kbthomp1/Catch2/src/catch2/../catch2/benchmark/catch_optimizer.hpp(66): error: expression preceding parentheses of apparent call must have (pointer-to-) function type
CATCH_FORWARD(fn) (CATCH_FORWARD(args)...);
^
detected during:
instantiation of "void Catch::Benchmark::Chronometer::measure(Fun &&, std::true_type) [with Fun=lambda [](int)->void]" at line 57 of "/hpnobackup2/kbthomp1/Catch2/src/catch2/../catch2/benchmark/catch_chronometer.hpp"
instantiation of "void Catch::Benchmark::Chronometer::measure(Fun &&, std::false_type) [with Fun=const Catch::Benchmark::Detail::BenchmarkFunction::do_nothing &]" at line 46 of "/hpnobackup2/kbthomp1/Catch2/src/catch2/../catch2/benchmark/catch_chronometer.hpp"
instantiation of "void Catch::Benchmark::Chronometer::measure(Fun &&) [with Fun=const Catch::Benchmark::Detail::BenchmarkFunction::do_nothing &]" at line 62 of "/hpnobackup2/kbthomp1/Catch2/src/catch2/../catch2/benchmark/detail/catch_benchmark_function.hpp"
instantiation of "void Catch::Benchmark::Detail::BenchmarkFunction::model<Fun>::call(Catch::Benchmark::Chronometer, std::false_type) const [with Fun=Catch::Benchmark::Detail::BenchmarkFunction::do_nothing]" at line 56 of "/hpnobackup2/kbthomp1/Catch2/src/catch2/../catch2/benchmark/detail/catch_benchmark_function.hpp"
instantiation of "void Catch::Benchmark::Detail::BenchmarkFunction::model<Fun>::call(Catch::Benchmark::Chronometer) const [with Fun=Catch::Benchmark::Detail::BenchmarkFunction::do_nothing]" at line 48 of "/hpnobackup2/kbthomp1/Catch2/src/catch2/../catch2/benchmark/detail/catch_benchmark_function.hpp"
implicit generation of "Catch::Benchmark::Detail::BenchmarkFunction::model<Fun>::~model() [with Fun=Catch::Benchmark::Detail::BenchmarkFunction::do_nothing]" at line 48 of "/hpnobackup2/kbthomp1/Catch2/src/catch2/../catch2/benchmark/detail/catch_benchmark_function.hpp"
instantiation of class "Catch::Benchmark::Detail::BenchmarkFunction::model<Fun> [with Fun=Catch::Benchmark::Detail::BenchmarkFunction::do_nothing]" at line 48 of "/hpnobackup2/kbthomp1/Catch2/src/catch2/../catch2/benchmark/detail/catch_benchmark_function.hpp"
instantiation of "Catch::Benchmark::Detail::BenchmarkFunction::model<Fun>::model(Fun &&) [with Fun=Catch::Benchmark::Detail::BenchmarkFunction::do_nothing]" at line 75 of "/hpnobackup2/kbthomp1/Catch2/src/catch2/../catch2/benchmark/detail/catch_benchmark_function.hpp"
compilation aborted for /hpnobackup2/kbthomp1/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp (code 2)
Expected behavior Using the default cmake configuration, the Catch2 library can be built using LLVM 14.0, gcc 6.2.0/8.3.0, and intel oneAPI version 2021.3.0 20210609, but fails to compile with the intel 19.0.5.281 20190815 compiler listed above.
Reproduction steps Configured without extra arguments to cmake, i.e.:
cd Catch2
mkdir build
cmake ..
make
Platform information:
- OS: Centos 7
- Compiler+version: Intel compiler version 19.0.5.281 20190815
- Catch version: v3.1.1
I am willing to merge a PR with reasonable workaround, but otherwise my advice is to use a better compiler.
Same problem on Intel 19.1.0.20200306
And "use a better compiler" is easier said then done if you're on a 10 thousand node supercomputer where you support dozens of packages: upgrading a compiler is a multi-week undertaking that is not undertaken lightly. Intel 19.1.1 was until very recently the most stable Intel compiler. I understand that it's not part of your CI workflow?