-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
I met compilation error 0.17.2 on gcc 11 or older. (gcc 13 and 14 work fine)
Error messages are following.
include/httplib/httplib.h: In member function 'constexpr size_t httplib::detail::case_ignore_hash::operator()(const string&) const':
include/httplib/httplib.h:359:30: error: call to non-'constexpr' function 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::data() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
359 | return hash_core(key.data(), key.size(), 0);
| ~~~~~~~~^~
In file included from /usr/local/include/c++/11.1.0/string:55,
from /usr/local/include/c++/11.1.0/bits/locale_classes.h:40,
from /usr/local/include/c++/11.1.0/bits/ios_base.h:41,
from /usr/local/include/c++/11.1.0/streambuf:41,
from /usr/local/include/c++/11.1.0/bits/streambuf_iterator.h:35,
from /usr/local/include/c++/11.1.0/iterator:66,
from /usr/local/include/c++/11.1.0/bits/ranges_algobase.h:36,
from /usr/local/include/c++/11.1.0/bits/ranges_algo.h:35,
from /usr/local/include/c++/11.1.0/algorithm:64,
from include/httplib/httplib.h:212,
from /work/test_package/test_package.cpp:1:
/usr/local/include/c++/11.1.0/bits/basic_string.h:2318:7: note: 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::data() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' declared here
2318 | data() const _GLIBCXX_NOEXCEPT
| ^~~~
The constexpr version of std::string::data()
has been introduced since C++20.
I think removing constexpr from httplib::detail::case_ignore_hash::operator()
solve this error.
Metadata
Metadata
Assignees
Labels
No labels