asio icon indicating copy to clipboard operation
asio copied to clipboard

Fix complilation wth clang in C++17 mode with -Werror -Wundef

Open cuavas opened this issue 10 months ago • 0 comments

clang 14 only defines __cpp_coroutines with -std=c++2a, it’s undefined with -std=c++17. This results in an undefined macro warning if you don’t check that it’s defined before comparing it to a literal with the -Wundef warning option:

In file included from asio/include/asio.hpp:18:
In file included from asio/include/asio/any_completion_executor.hpp:18:
asio/include/asio/detail/config.hpp:1317:39: error: '__cpp_coroutines' is not defined, evaluates to 0 [-Werror,-Wundef]
#    elif (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
                                      ^

This pull request adds the check to avoid the warning.

cuavas avatar Apr 22 '24 07:04 cuavas