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

Fix non-const string issue with C++20 #579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kgreenek
Copy link

Without this change, compiling with C++20 gives the following error due to the way std::string being used for the logging statement (which was not constexpr).

In file included from external/oustersdk/ouster_client/src/sensor_http_imp.cpp:3:
external/oustersdk/ouster_client/src/curl_client.h: In member function 'std::string CurlClient::execute_get(const string&, int, int) const':
external/oustersdk/ouster_client/src/curl_client.h:91:46: error: temporary of non-literal type 'std::__cxx11::basic_string<char>' in a constant expression
   91 |                 ouster::sensor::logger().warn(
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
   92 |                     std::string("Re-attempting CurlClient::execute_get after "
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   93 |                                 "failure for url: ") +
      |                                 ~~~~~~~~~~~~~~~~~~~~~~
   94 |                         "[{}] with the code: [{}] - and return: {}",
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   95 |                     url, http_code, buffer);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~   
In file included from /usr/include/c++/11/string:55,
                 from external/oustersdk/ouster_client/src/http_client.h:13,
                 from external/oustersdk/ouster_client/src/sensor_http_imp.h:12,
                 from external/oustersdk/ouster_client/src/sensor_http_imp.cpp:1:
/usr/include/c++/11/bits/basic_string.h:85:11: note: 'std::__cxx11::basic_string<char>' is not literal because:
   85 |     class basic_string
      |           ^~~~~~~~~~~~
/usr/include/c++/11/bits/basic_string.h:85:11: note:   'std::__cxx11::basic_string<char>' does not have 'constexpr' destructor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant