Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warnings: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated] #253

Closed
gocarlos opened this issue Mar 5, 2020 · 3 comments
Assignees
Labels
fix added A fix has been pushed to the repo and is being tested
Milestone

Comments

@gocarlos
Copy link

gocarlos commented Mar 5, 2020

In file included from /home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/async_client.h:37,
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h: In lambda function:
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:153:25: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
  153 |    notFullCond_.wait(g, [=]{return que_.size() < cap_;});
      |                         ^
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:153:25: note: add explicit ‘this’ or ‘*this’ capture
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h: In lambda function:
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:190:55: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
  190 |   if (n >= cap_ && !notFullCond_.wait_for(g, relTime, [=]{return que_.size() < cap_;}))
      |                                                       ^
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:190:55: note: add explicit ‘this’ or ‘*this’ capture
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h: In lambda function:
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:213:57: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
  213 |   if (n >= cap_ && !notFullCond_.wait_until(g, absTime, [=]{return que_.size() < cap_;}))
      |                                                         ^
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:213:57: note: add explicit ‘this’ or ‘*this’ capture
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h: In lambda function:
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:232:26: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
  232 |    notEmptyCond_.wait(g, [=]{return !que_.empty();});
      |                          ^
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:232:26: note: add explicit ‘this’ or ‘*this’ capture
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h: In lambda function:
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:250:26: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
  250 |    notEmptyCond_.wait(g, [=]{return !que_.empty();});
      |                          ^
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:250:26: note: add explicit ‘this’ or ‘*this’ capture
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h: In lambda function:
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:294:53: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
  294 |   if (n == 0 && !notEmptyCond_.wait_for(g, relTime, [=]{return !que_.empty();}))
      |                                                     ^
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:294:53: note: add explicit ‘this’ or ‘*this’ capture
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h: In lambda function:
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:318:55: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
  318 |   if (n == 0 && !notEmptyCond_.wait_until(g, absTime, [=]{return !que_.empty();}))
      |                                                       ^
/home/gocarlos/.conan/data/paho-mqtt-cpp/1.0.1/_/_/package/de1bbfb8eed70320d3c37ce9521ac7e673c69477/include/mqtt/thread_queue.h:318:55: note: add explicit ‘this’ or ‘*this’ capture
@fpagliughi
Copy link
Contributor

I've been resistant to push this library forward into the new standards until they stabilize, but the fix to this seems better and more explicit that what's there now, so it seems worth adding sooner than later.

@fpagliughi fpagliughi self-assigned this Mar 24, 2020
@fpagliughi fpagliughi added this to the v1.2 milestone Mar 24, 2020
@fpagliughi
Copy link
Contributor

Apologies that I didn't get this into the new release. I'm going to start looking into C++20 now that it's "official" and probably do a point release (v1.2.1) to address any issues like this.

@fpagliughi fpagliughi modified the milestones: v1.2, v1.2.1 Dec 27, 2020
@fpagliughi
Copy link
Contributor

Fixed this. We can add any other ones that pop up to #340

@fpagliughi fpagliughi modified the milestones: v1.2.1, v1.3 Mar 16, 2023
emrahayanoglu pushed a commit to emrahayanoglu/paho.mqtt.cpp that referenced this issue May 3, 2023
@fpagliughi fpagliughi added the fix added A fix has been pushed to the repo and is being tested label Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix added A fix has been pushed to the repo and is being tested
Projects
None yet
Development

No branches or pull requests

2 participants