zaphoyd / websocketpp

C++ websocket client/server library
http://www.zaphoyd.com/websocketpp
Other
7.03k stars 1.97k forks source link

In basic.hpp, a few compiling error with g++11, C++20, #991

Open yushb0602 opened 3 years ago

yushb0602 commented 3 years ago

I have tried the lastest version, and v0.8.2 tags, the same error message. No this message if compile with C++17.


/home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:61:54: error: expected ')' before 'h' 61 | basic<concurrency,names>(channel_type_hint::value h =channel_type_hint::access) | ~ ^~ | ) /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:66:42: error: expected ')' before '' token 66 | basic<concurrency,names>(std::ostream out) | ~ ^~ | ) /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:71:35: error: expected ')' before 'c' 71 | basic<concurrency,names>(level c, channel_type_hint::value h = | ~ ^~ | ) /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:77:35: error: expected ')' before 'c' 77 | basic<concurrency,names>(level c, std::ostream * out) | ~ ^~ | ) /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:83:5: error: template-id not allowed for destructor 83 | ~basic<concurrency,names>() {} | ^ /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:86:54: error: expected ')' before 'const' 86 | basic<concurrency,names>(basic<concurrency,names> const & other) | ~ ^~ | ) /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:99:54: error: expected ')' before '&&' token 99 | basic<concurrency,names>(basic<concurrency,names> && other) | ~ ^~~ | ) In file included from /home/OGic-2/cppsrc/../3rdparty/websocketpp/roles/server_endpoint.hpp:31, from /home/OGic-2/cppsrc/../3rdparty/websocketpp/server.hpp:31, from /home/OGic-2/cppsrc/ws.hpp:4, from /home/OGic-2/cppsrc/main.cpp:15: /home/OGic-2/cppsrc/../3rdparty/websocketpp/endpoint.hpp:112:5: error: template-id not allowed for destructor 112 | ~endpoint<connection,config>() {} | ^ In file included from /home/OGic-2/cppsrc/../3rdparty/websocketpp/server.hpp:31, from /home/OGic-2/cppsrc/ws.hpp:4, from /home/OGic-2/cppsrc/main.cpp:15: /home/OGic-2/cppsrc/../3rdparty/websocketpp/roles/server_endpoint.hpp:75:5: error: template-id not allowed for destructor 75 | ~server() {} | ^ /home/OGic-2/cppsrc/../3rdparty/websocketpp/roles/server_endpoint.hpp:79:34: error: expected ')' before '&' token 79 | server(server &) = delete; | ~ ^~ | ) /home/OGic-2/cppsrc/../3rdparty/websocketpp/roles/server_endpoint.hpp:87:34: error: expected ')' before '&&' token 87 | server(server && o) : endpoint<connection,config>(std::move(o)) {} | ~ ^~~ | ) In file included from /home/OGic-2/cppsrc/globals.h:11, from /home/OGic-2/cppsrc/CChannel.h:11, from /home/OGic-2/cppsrc/COGCore.h:13, from /home/OGic-2/cppsrc/main.cpp:17: /home/OGic-2/cppsrc/../3rdparty/nlohmann/json.hpp: In static member function 'static CharType nlohmann::detail::binary_writer<BasicJsonType, CharType>::to_char_type(uint8_t)': /home/OGic-2/cppsrc/../3rdparty/nlohmann/json.hpp:12595:28: warning: 'template struct std::is_pod' is deprecated: use is_standard_layout && is_trivial instead [-Wdeprecated-declarations] 12595 | static_assert(std::is_pod::value, "CharType must be POD"); | ^~ In file included from /home/OGic-2/cppsrc/../3rdparty/fmt/ranges.h:16, from /home/OGic-2/cppsrc/main.cpp:3: /usr/local/include/c++/11.1.0/type_traits:700:5: note: declared here 700 | is_pod | ^~ In file included from /home/OGic-2/cppsrc/../3rdparty/websocketpp/roles/server_endpoint.hpp:31, from /home/OGic-2/cppsrc/../3rdparty/websocketpp/server.hpp:31, from /home/OGic-2/cppsrc/ws.hpp:4, from /home/OGic-2/cppsrc/main.cpp:15: /home/OGic-2/cppsrc/../3rdparty/websocketpp/endpoint.hpp: In instantiation of 'websocketpp::endpoint<connection, config>::endpoint(bool) [with connection = websocketpp::connection; config = websocketpp::config::asio]': /home/OGic-2/cppsrc/../3rdparty/websocketpp/roles/server_endpoint.hpp:69:43: required from 'websocketpp::server::server() [with config = websocketpp::config::asio]' /home/OGic-2/cppsrc/ws.hpp:12:22: required from here /home/OGic-2/cppsrc/../3rdparty/websocketpp/endpoint.hpp:92:16: error: no matching function for call to 'websocketpp::log::basic<websocketpp::concurrency::basic, websocketpp::log::alevel>::basic(const level&, const value&)' 92 | : m_alog(new alog_type(config::alog_level, log::channel_type_hint::access)) | ^~~~~~~~~~~~~~~~~ In file included from /home/OGic-2/cppsrc/../3rdparty/websocketpp/config/core.hpp:51, from /home/OGic-2/cppsrc/../3rdparty/websocketpp/config/asio_no_tls.hpp:31, from /home/OGic-2/cppsrc/ws.hpp:3, from /home/OGic-2/cppsrc/main.cpp:15: /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:59:7: note: candidate: 'websocketpp::log::basic<websocketpp::concurrency::basic, websocketpp::log::alevel>::basic()' (deleted) 59 | class basic { | ^~~~~ /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:59:7: note: candidate expects 0 arguments, 2 provided /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:59:7: note: candidate: 'websocketpp::log::basic<websocketpp::concurrency::basic, websocketpp::log::alevel>::basic(const websocketpp::log::basic<websocketpp::concurrency::basic, websocketpp::log::alevel>&)' (deleted) /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:59:7: note: candidate expects 1 argument, 2 provided In file included from /home/OGic-2/cppsrc/../3rdparty/websocketpp/roles/server_endpoint.hpp:31, from /home/OGic-2/cppsrc/../3rdparty/websocketpp/server.hpp:31, from /home/OGic-2/cppsrc/ws.hpp:4, from /home/OGic-2/cppsrc/main.cpp:15: /home/OGic-2/cppsrc/../3rdparty/websocketpp/endpoint.hpp:93:16: error: no matching function for call to 'websocketpp::log::basic<websocketpp::concurrency::basic, websocketpp::log::elevel>::basic(const level&, const value&)' 93 | , m_elog(new elog_type(config::elog_level, log::channel_type_hint::error)) | ^~~~~~~~~~~~~~~~ In file included from /home/OGic-2/cppsrc/../3rdparty/websocketpp/config/core.hpp:51, from /home/OGic-2/cppsrc/../3rdparty/websocketpp/config/asio_no_tls.hpp:31, from /home/OGic-2/cppsrc/ws.hpp:3, from /home/OGic-2/cppsrc/main.cpp:15: /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:59:7: note: candidate: 'websocketpp::log::basic<websocketpp::concurrency::basic, websocketpp::log::elevel>::basic()' (deleted) 59 | class basic { | ^~~~~ /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:59:7: note: candidate expects 0 arguments, 2 provided /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:59:7: note: candidate: 'websocketpp::log::basic<websocketpp::concurrency::basic, websocketpp::log::elevel>::basic(const websocketpp::log::basic<websocketpp::concurrency::basic, websocketpp::log::elevel>&)' (deleted) /home/OGic-2/cppsrc/../3rdparty/websocketpp/logger/basic.hpp:59:7: note: candidate expects 1 argument, 2 provided make[2]: [CMakeFiles/cpp20.dir/build.make:76: CMakeFiles/cpp20.dir/main.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:232: CMakeFiles/cpp20.dir/all] Error 2

Arthapz commented 3 years ago

Same issue there with GCC 11.0.1 in C++20 mode

Arthapz commented 3 years ago

the reason is the useless usage of <concurrency,names> after constructor definition (and destructor), after removing them, it build fine

jcelerier commented 3 years ago

can confirm the issue (and the solution)

jcelerier commented 3 years ago

note that this was valid until C++20: https://timsong-cpp.github.io/cppwp/n4861/diff.cpp17.class#2

jcelerier commented 3 years ago

feel free to pull my patch https://github.com/jcelerier/websocketpp/commit/3e761b5aa2d415bbe8cf211c7c9a847e4e5f2044

Macfly commented 3 years ago

do you think it will be merged at some point? looks like the project hasn't had any commit in a long time... It is a bit annoying when you are using a package manager like Conan.

zaphoyd commented 3 years ago

A fix for this has been pushed to the develop branch. That branch will be rolled up into a 0.9 release soon.

Macfly commented 3 years ago

A fix for this has been pushed to the develop branch. That branch will be rolled up into a 0.9 release soon.

any update on the 0.9 release?

lapointexavier commented 3 years ago

Will fork to get the changes from develop in the meantime, but a new 0.9 release would be great 🙏

Ramjii commented 2 years ago

Bump on the 0.9 release 🙏 Works like a charm on Windows

plsmaop commented 2 years ago

Please bump on the 0.9 release QQ

Elwinnaar commented 11 months ago

Bump for 0.9 release, please!

Amtrix commented 11 months ago

2000 years later

GianlucaCerilli commented 7 months ago

3000 years later