Hi @ all,
I am using constexpr if widely within my code. After a successfull build with the gcc I wanted to use *the good stuff*, namely icpc.
Here is a short example of my code:
/*...*/ virtual inline void run( ) override { #pragma omp parallel for for( std::size_t i = 0; i < REP_COUNT; ++i ) { //... if constexpr( ( PROCESS_DATA_COUNT / 4 ) >= 2 ) { //... } if constexpr( ( PROCESS_DATA_COUNT / 4 ) == 4 ) { //... } } } /*...*/
When I try to compile it with the icpc (Version 18.0.0.128 Build 20170811), it breaks with the following output:
/usr/include/c++/7/bits/stl_pair.h(79): error: inline specifier allowed on function declarations only
_GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct =
^/usr/include/c++/7/utility(345): error: inline specifier allowed on function declarations only
inline constexpr in_place_t in_place{};
^... error: expected a "("
if constexpr( ( PROCESS_DATA_COUNT / 4 ) >= 2 ) {
^
Is there no constexpr if within the newest icpc? Is there a proper workaround?
Sincerely yours