chriskohlhoff / asio

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

The 1.22.1 tarball published at SF doesn't include cpp20 examples #1026

Open DarthGandalf opened 2 years ago

DarthGandalf commented 2 years ago

I see the src/examples/cpp20/ directory in source here, but not in asio-1.22.1.tar.bz2 at https://sourceforge.net/projects/asio/files/asio/1.22.1%20%28Stable%29/asio-1.22.1.tar.bz2

However, src/Makefile.am mentions it as EXAMPLES_CPP20 = examples/cpp20

daniel-mdb commented 2 years ago

I have tested this locally and the problem lies on the fact compilers still don't have a general support for CPP20

Results on an up-to-date Arch Linux:

$ g++ --version ; cat cpp20.cc ; g++ cpp20.cc ;
g++ (GCC) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

#if __cplusplus < 202002L
#error C++20 not available
#endif 

int main() {
  return 0;
}
cpp20.cc:2:2: error: #error C++20 not available
    2 | #error C++20 not available
      |   ^~~~~
$
DarthGandalf commented 2 years ago

@daniel-mdb that is not a problem. https://github.com/chriskohlhoff/asio/blob/bba12d10501418fd3789ce01c9f86a77d37df7ed/asio/configure.ac#L172-L181 checks whether it's available on your system or not, and disables it via automake.

But the build is broken regardless, even if C++20 is actually supported, because the directory referenced is missing.