Please use std::chrono::parse instead of date::parse #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
Several compiler(gcc14, latest MSVC) don't support "date" library on C++20 or later.
compilation errors on gcc14 in C++20.
src/reduct/client.cc: In member function ‘virtual reduct::Resultreduct::IClient::ServerInfo reduct::Client::GetInfo() const’:
src/reduct/client.cc:60:24: error: no matching function for call to ‘parse(const char [7], reduct::IClient::Time&)’
60 | date::parse("%FT%TZ", server_info.license->expiry_date);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/reduct/client.cc:5:
include/date/date.h:8086:1: note: candidate: ‘template<class Parsable, class CharT, class Traits, class Alloc> decltype ((date::from_stream(declval<std::basic_istream<_CharT, _Traits>&>(), format.c_str(), tp), date::parse_manip<Parsable, CharT, Traits, Alloc>{format, tp})) date::parse(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, Parsable&)’
8086 | parse(const std::basic_string<CharT, Traits, Alloc>& format, Parsable& tp)
| ^~~~~
include/date/date.h:8086:1: note: template argument deduction/substitution failed:
src/reduct/client.cc:60:24: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘const char [7]’
60 | date::parse("%FT%TZ", server_info.license->expiry_date);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/date/date.h:8097:1: note: candidate: ‘template<class Parsable, class CharT, class Traits, class Alloc> decltype ((date::from_stream(declval<std::basic_istream<_CharT, _Traits>&>(), format.c_str(), tp, (& abbrev)), date::parse_manip<Parsable, CharT, Traits, Alloc>{format, tp, (& abbrev)})) date::parse(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, Parsable&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
8097 | parse(const std::basic_string<CharT, Traits, Alloc>& format, Parsable& tp,
| ^~~~~
include/date/date.h:8097:1: note: candidate expects 3 arguments, 2 provided
include/date/date.h:8109:1: note: candidate: ‘template<class Parsable, class CharT, class Traits, class Alloc> decltype ((date::from_stream(declval<std::basic_istream<_CharT, _Traits>&>(), format.c_str(), tp, declval<std::__cxx11::basic_string<_CharT, _Traits, _Alloc>>(), (& offset)), date::parse_manip<Parsable, CharT, Traits, Alloc>{format, tp, nullptr, (& offset)})) date::parse(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, Parsable&, std::chrono::minutes&)’
8109 | parse(const std::basic_string<CharT, Traits, Alloc>& format, Parsable& tp,
| ^~~~~
include/date/date.h:8109:1: note: candidate expects 3 arguments, 2 provided
include/date/date.h:8123:1: note: candidate: ‘template<class Parsable, class CharT, class Traits, class Alloc> decltype ((date::from_stream(declval<std::basic_istream<_CharT, _Traits>&>(), format.c_str(), tp, (& abbrev), (& offset)), date::parse_manip<Parsable, CharT, Traits, Alloc>{format, tp, (& abbrev), (& offset)})) date::parse(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, Parsable&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::chrono::minutes&)’
8123 | parse(const std::basic_string<CharT, Traits, Alloc>& format, Parsable& tp,
| ^~~~~
include/date/date.h:8123:1: note: candidate expects 4 arguments, 2 provided
include/date/date.h:8137:1: note: candidate: ‘template<class Parsable, class CharT> decltype ((date::from_stream(declval<std::basic_istream<CharT, std::char_traits<_CharT> >&>(), format, tp), date::parse_manip<Parsable, CharT>{format, tp})) date::parse(const CharT, Parsable&)’
8137 | parse(const CharT* format, Parsable& tp)
| ^~~~~
include/date/date.h:8137:1: note: template argument deduction/substitution failed:
include/date/date.h: In substitution of ‘template<class Parsable, class CharT> decltype ((date::from_stream(declval<std::basic_istream<CharT, std::char_traits<_CharT> >&>(), format, tp), date::parse_manip<Parsable, CharT>{format, tp})) date::parse(const CharT*, Parsable&) [with Parsable = std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >; CharT = char]’:
src/reduct/client.cc:60:24: required from here
60 | date::parse("%FT%TZ", server_info.license->expiry_date);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/date/date.h:8138:28: error: call of overloaded ‘from_stream(std::basic_istream&, const char*&, std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >&)’ is ambiguous
8138 | -> decltype(from_stream(std::declval<std::basic_istream&>(), format, tp),
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/date/date.h:8000:1: note: candidate: ‘std::basic_istream<_CharT, _Traits>& date::from_stream(std::basic_istream<_CharT, _Traits>&, const CharT*, sys_time&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>, std::chrono::minutes) [with Duration = std::chrono::duration<long int, std::ratio<1, 1000000000> >; CharT = char; Traits = std::char_traits; Alloc = std::allocator; sys_time = std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >; std::chrono::minutes = std::chrono::duration<long int, std::ratio<60> >]’
8000 | from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
| ^~~~~~~~~~~
In file included from /usr/include/c++/14/chrono:3360,
from src/reduct/client.h:6,
from src/reduct/client.cc:3:
/usr/include/c++/14/bits/chrono_io.h:2733:5: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::chrono::from_stream(std::basic_istream<_CharT, _Traits>&, const _CharT*, sys_time<_Duration>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>, minutes) [with _CharT = char; _Traits = std::char_traits; _Duration = duration<long int, std::ratio<1, 1000000000> >; _Alloc = std::allocator; sys_time<_Duration> = time_point<_V2::system_clock, duration<long int, std::ratio<1, 1000000000> > >; minutes = duration<long int, std::ratio<60> >]’
2733 | from_stream(basic_istream<_CharT, _Traits>& __is, const _CharT* __fmt,
| ^~~~~~~~~~~
include/date/date.h:8147:1: note: candidate: ‘template<class Parsable, class CharT, class Traits, class Alloc> decltype ((date::from_stream(declval<std::basic_istream<_CharT, _Traits>&>(), format, tp, (& abbrev)), date::parse_manip<Parsable, CharT, Traits, Alloc>{format, tp, (& abbrev)})) date::parse(const CharT*, Parsable&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
8147 | parse(const CharT* format, Parsable& tp, std::basic_string<CharT, Traits, Alloc>& abbrev)
| ^~~~~
include/date/date.h:8147:1: note: candidate expects 3 arguments, 2 provided
include/date/date.h:8158:1: note: candidate: ‘template<class Parsable, class CharT> decltype ((date::from_stream(declval<std::basic_istream<CharT, std::char_traits<_CharT> >&>(), format, tp, declval<std::__cxx11::basic_string<_CharT, std::char_traits<_CharT>, std::allocator<_T2> >>(), (& offset)), date::parse_manip<Parsable, CharT>{format, tp, nullptr, (& offset)})) date::parse(const CharT, Parsable&, std::chrono::minutes&)’
8158 | parse(const CharT* format, Parsable& tp, std::chrono::minutes& offset)
| ^~~~~
include/date/date.h:8158:1: note: candidate expects 3 arguments, 2 provided
include/date/date.h:8169:1: note: candidate: ‘template<class Parsable, class CharT, class Traits, class Alloc> decltype ((date::from_stream(declval<std::basic_istream<_CharT, _Traits>&>(), format, tp, (& abbrev), (& offset)), date::parse_manip<Parsable, CharT, Traits, Alloc>{format, tp, (& abbrev), (& offset)})) date::parse(const CharT*, Parsable&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::chrono::minutes&)’
8169 | parse(const CharT* format, Parsable& tp,
| ^~~~~
What was changed?
use std::chrono::parse instead of date::parse
Related issues
nothing.
Does this PR introduce a breaking change?
nothing.
Other information:
nothing.