Only add conditional constexpr to get() for >= C++14 to work around errors on older compilers.

This commit is contained in:
Anthony VH 2021-01-14 12:39:03 +01:00
parent d7c0f157c5
commit 6eb37e9b78
2 changed files with 8 additions and 2 deletions

View File

@ -3063,7 +3063,10 @@ class basic_json
@since version 2.1.0 @since version 2.1.0
*/ */
template < typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>> template < typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>>
constexpr auto get() const noexcept( #if defined(JSON_HAS_CPP_14)
constexpr
#endif
auto get() const noexcept(
noexcept(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))) noexcept(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {})))
-> decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {})) -> decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))
{ {

View File

@ -19815,7 +19815,10 @@ class basic_json
@since version 2.1.0 @since version 2.1.0
*/ */
template < typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>> template < typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>>
constexpr auto get() const noexcept( #if defined(JSON_HAS_CPP_14)
constexpr
#endif
auto get() const noexcept(
noexcept(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))) noexcept(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {})))
-> decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {})) -> decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))
{ {