nanobench icon indicating copy to clipboard operation
nanobench copied to clipboard

Doesn't compile with Intel's c++ 2025 compiler

Open pps83 opened this issue 9 months ago • 1 comments

I can include nanobench.h, however, it fails when ANKERL_NANOBENCH_IMPLEMENT is defined with icx 2025 on windows. Note, on windows it uses libraries that come with msvc. Intel's compiler is clang based, however, clang that comes with msvc (and intel c++ 2024) both have no issues with nanobench.h+ANKERL_NANOBENCH_IMPLEMENT

this is the error I get:

Build started at 13:12...
1>------ Build started: Project: common, Configuration: Release x64 ------
1>In file included from D:\src\util.cpp:2:
1>In file included from D:\nanobench\src\include\nanobench.h:42:
1>In file included from d:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.44.34918\include\chrono:13:
1>In file included from d: : error : 13:
1>In file included from d:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.44.34918\include\stdexcept:11:
1>In file included from d:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.44.34918\include\xstring:13:
1>In file included from d:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.44.34918\include\xmemory:18:
1>d:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.44.34918\include\tuple(196,101): : error : pack expansion contains parameter packs '_TTypes' and '_Indices' that have different lengths (1 vs. 2)
1>  196 |     (requires { typename _Synth_three_way_result<_TTypes, tuple_element_t<_Indices, _UTuple>>; } && ...)
1>      |                                                  ~~~~~~~                  ~~~~~~~~                  ^
1>d:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.44.34918\include\tuple(202,1): note: while checking constraint satisfaction for class template partial specialization '_Three_way_comparison_result_with_tuple_like<const std::basic_string<char> &, std::tuple<const double &, const std::basic_string<char> &>, 0ULL, 1ULL>' required here
1>  202 | using _Three_way_comparison_result_with_tuple_like_t =
1>      | ^~~~~
1>d:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.44.34918\include\tuple(202,1): note: during template argument deduction for class template partial specialization '_Three_way_comparison_result_with_tuple_like<tuple<_TTypes...>, _UTuple, index_sequence<_Indices...>>' [with _TTypes = <const std::basic_string<char> &>, _UTuple = std::tuple<const double &, const std::basic_string<char> &>, _Indices = <0, 1>]
1>d:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.44.34918\include\tuple(202,1): note: in instantiation of template class 'std::_Three_way_comparison_result_with_tuple_like<std::tuple<const std::basic_string<char> &>, std::tuple<const double &, const std::basic_string<char> &>>' requested here
1>d:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.44.34918\include\tuple(784,12): note: in instantiation of template type alias '_Three_way_comparison_result_with_tuple_like_t' requested here
1>  784 |         -> _Three_way_comparison_result_with_tuple_like_t<tuple, _Other> {
1>      |            ^
1>D:\nanobench\src\include\nanobench.h(3461,55): note: while substituting deduced template arguments into function template 'operator<=>' [with _Other = tuple<const double &, const basic_string<char, char_traits<char>, allocator<char>> &>]
1> 3461 |     return std::tie(mNormalizedRootMeanSquare, mName) < std::tie(other.mNormalizedRootMeanSquare, other.mName);
1>      |                                                       ^
1>1 error generated.

util.cpp is simply this:

#define ANKERL_NANOBENCH_IMPLEMENT
#include "../nanobench/src/include/nanobench.h"

pps83 avatar Apr 09 '25 11:04 pps83

I suspect it's an issue with msvc std lib: https://github.com/microsoft/STL/issues/5395

pps83 avatar Apr 09 '25 13:04 pps83