chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.71k stars 1.19k forks source link

ASIO fails on stringview errors when compiling with QNX-compiler and using -std=c++14 #1098

Open ngroendyk opened 1 year ago

ngroendyk commented 1 year ago

It has been consistently observed when building using the QNX compiler (when the language is set to the C++14 standard) that the compiler-set #define "__cplusplus" is set to 201402

This causes the asio header library to include C++17 features that are not yet enabled/configured by the toolchain (since it is configured for C++14), resulting in stringview failures.

chriskohlhoff commented 1 year ago

The proposed changes seem to confuse valid __cplusplus values with the values used by C++ feature macros (like __cpp_lib_experimental_string_view).

In any case, i would expect that this change would be a pure addition (e.g. using #if defined(__QNXTO__) ...) and not alter the behaviour for other compilers.

In the meantime, you may change your build settings to define ASIO_DISABLE_STD_STRING_VIEW and ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW as needed.