hazelcast-cpp-client icon indicating copy to clipboard operation
hazelcast-cpp-client copied to clipboard

Deprecated warning when Hazelcast compiled with C++20 option.

Open cngzhnp opened this issue 2 years ago • 0 comments

C++ compiler version: GNU 10.2.1 Hazelcast Cpp client version: 5.2.1 Hazelcast server version: 5.0.0 Number of the clients: - Cluster size, i.e. the number of Hazelcast cluster members: OS version (Windows/Linux/OSX): Linux

Please attach relevant logs and files for client and server side.

Expected behaviour

Warnings must be cleaned up if they are treated as errors.

Actual behaviour

It is not cleaned up. When "-Werror" flag is activated during build, it breaks the build due this error.

Steps to reproduce the behaviour

Hazelcast-cpp-client project must be compiled with C++20 flag option. Then, you will get an error such as below:

In file included from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/ProxyImpl.h:19,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/IMapImpl.h:22,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:31,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/impl/hazelcast_client_instance_impl.h:25,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast_client.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast.h:24,
                 
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:118:35: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  118 |                     return f.then([=] (boost::future<boost::optional<serialization::pimpl::data>> f) {
      |                                   ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:118:35: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:138:56: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  138 |                     return f.then(boost::launch::sync, [=](boost::future<serialization::pimpl::data> f) {
      |                                                        ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:138:56: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:146:35: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  146 |                                   [=](boost::future<std::unique_ptr<serialization::pimpl::data>> f) {
      |                                   ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:146:35: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:155:45: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  155 |                                             [=](boost::future<std::vector<serialization::pimpl::data>> f) {
      |                                             ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:155:45: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:169:67: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  169 |                     return entries_data.then(boost::launch::sync, [=](boost::future<EntryVector> f) {
      |                                                                   ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:169:67: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:183:66: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  183 |                     return data_future.then(boost::launch::sync, [=](boost::future<EntryVector> f) {
      |                                                                  ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/SerializingProxy.h:183:66: note: add explicit 'this' or '*this' capture
In file included from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/impl/hazelcast_client_instance_impl.h:25,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast_client.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast.h:24,

/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:545:80: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  545 |                 return proxy::IMapImpl::get_entry_view_data(to_data(key)).then([=] (boost::future<boost::optional<map::data_entry_view>> f) {
      |                                                                                ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:545:80: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:598:77: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  598 |                                                                             [=](boost::future<boost::csbl::vector<boost::future<EntryVector>>> results_data) {
      |                                                                             ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:598:77: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:658:25: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  658 |                         [=, &predicate](
      |                         ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:658:25: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:711:25: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  711 |                         [=, &predicate](boost::future<std::pair<std::vector<serialization::pimpl::data>, query::anchor_data_list>> f) {
      |                         ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:711:25: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:766:25: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  766 |                         [=, &predicate](boost::future<std::pair<EntryVector, query::anchor_data_list>> f) {
      |                         ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/imap.h:766:25: note: add explicit 'this' or '*this' capture
In file included from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/internal/nearcache/impl/DefaultNearCache.h:30,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/internal/nearcache/NearCacheManager.h:23,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h:25,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/impl/hazelcast_client_instance_impl.h:25,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast_client.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast.h:24,

/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/spi/impl/ClientExecutionServiceImpl.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/spi/impl/ClientExecutionServiceImpl.h:89:43: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
   89 |                         timer->async_wait([=](boost::system::error_code ec) {
      |                                           ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/spi/impl/ClientExecutionServiceImpl.h:89:43: note: add explicit 'this' or '*this' capture
In file included from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/internal/nearcache/NearCacheManager.h:23,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h:25,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/impl/hazelcast_client_instance_impl.h:25,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast_client.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast.h:24,

/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/internal/nearcache/impl/DefaultNearCache.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/internal/nearcache/impl/DefaultNearCache.h:161:37: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  161 |                                     [=]() {
      |                                     ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/internal/nearcache/impl/DefaultNearCache.h:161:37: note: add explicit 'this' or '*this' capture
In file included from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/impl/hazelcast_client_instance_impl.h:25,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast_client.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast.h:24,

/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h:133:48: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  133 |                                                [=](boost::future<boost::optional<serialization::pimpl::data>> f) {
      |                                                ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h:133:48: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h:335:54: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  335 |                                 boost::launch::sync, [=](boost::future<EntryVector> f) {
      |                                                      ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/map/NearCachedClientMapProxy.h:335:54: note: add explicit 'this' or '*this' capture
In file included from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/replicated_map.h:21,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/impl/hazelcast_client_instance_impl.h:31,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast_client.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast.h:24,

/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/ReplicatedMapImpl.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/ReplicatedMapImpl.h:202:48: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  202 |                                                [=](boost::future<boost::optional<serialization::pimpl::data>> f) {
      |                                                ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/proxy/ReplicatedMapImpl.h:202:48: note: add explicit 'this' or '*this' capture
In file included from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/impl/hazelcast_client_instance_impl.h:43,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast_client.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast.h:24,

/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/spi/ProxyManager.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/spi/ProxyManager.h:58:92: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
   58 |                     auto proxy_future = initialize(client_proxy).then(boost::launch::sync, [=](boost::future<void> f) {
      |                                                                                            ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/spi/ProxyManager.h:58:92: note: add explicit 'this' or '*this' capture
In file included from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/impl/hazelcast_client_instance_impl.h:44,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast_client.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast.h:24,

/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/ringbuffer.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/ringbuffer.h:233:117: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  233 |                 return read_many_data(start_sequence, min_count, max_count, &filter_data).then(boost::launch::sync, [=] (boost::future<protocol::ClientMessage> f) {
      |                                                                                                                     ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/ringbuffer.h:233:117: note: add explicit 'this' or '*this' capture
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/ringbuffer.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/ringbuffer.h:257:112: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  257 |                 return read_many_data(start_sequence, min_count, max_count, nullptr).then(boost::launch::sync, [=] (boost::future<protocol::ClientMessage> f) {
      |                                                                                                                ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/ringbuffer.h:257:112: note: add explicit 'this' or '*this' capture
In file included from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/impl/hazelcast_client_instance_impl.h:53,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast_client.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast.h:24,

/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/iexecutor_service.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/iexecutor_service.h:470:58: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  470 |                                                          [=](boost::future<protocol::ClientMessage> f) {
      |                                                          ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/iexecutor_service.h:470:58: note: add explicit 'this' or '*this' capture
In file included from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/impl/hazelcast_client_instance_impl.h:55,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast_client.h:20,
                 from /usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/client/hazelcast.h:24,

/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/cp/cp.h: In lambda function:
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/cp/cp.h:1244:67: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
 1244 |                 return get_group_id(proxy_name, object_name).then([=] (boost::future<raft_group_id> f) {
      |                                                                   ^
/usr/src/app/3rdParty/hazelcast/hazelcast/include/hazelcast/cp/cp.h:1244:67: note: add explicit 'this' or '*this' capture

In my opinion, this keyword must be written in the lambda expression explicitly to get rid of such an error.

cngzhnp avatar Dec 13 '22 14:12 cngzhnp