diff options
Diffstat (limited to 'libstdc++-v3/include')
| -rw-r--r-- | libstdc++-v3/include/bits/regex.tcc | 49 | ||||
| -rw-r--r-- | libstdc++-v3/include/bits/version.def | 9 | ||||
| -rw-r--r-- | libstdc++-v3/include/bits/version.h | 10 | ||||
| -rw-r--r-- | libstdc++-v3/include/std/regex | 1 | ||||
| -rw-r--r-- | libstdc++-v3/include/std/tuple | 53 | ||||
| -rw-r--r-- | libstdc++-v3/include/std/type_traits | 17 | 
6 files changed, 123 insertions, 16 deletions
| diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc index b94fe44..48917cd 100644 --- a/libstdc++-v3/include/bits/regex.tcc +++ b/libstdc++-v3/include/bits/regex.tcc @@ -331,20 +331,53 @@ namespace __detail  	    && __c == __fctyp.widen('_'));      } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr    template<typename _Ch_type>      int      regex_traits<_Ch_type>::      value(_Ch_type __ch, int __radix) const      { -      std::basic_istringstream<char_type> __is(string_type(1, __ch)); -      long __v; -      if (__radix == 8) -	__is >> std::oct; -      else if (__radix == 16) -	__is >> std::hex; -      __is >> __v; -      return __is.fail() ? -1 : __v; +      if constexpr (sizeof(_Ch_type) > 1) +	{ +	  const auto& __ctyp = std::use_facet<ctype<_Ch_type>>(_M_locale); +	  const char __c = __ctyp.narrow(__ch, '\0'); +	  return regex_traits<char>{}.value(__c, __radix); +	} +      else +	{ +	  const char __c = static_cast<char>(__ch); +	  const char __max_digit = __radix == 8 ? '7' : '9'; +	  if ('0' <= __c && __c <= __max_digit) +	    return __c - '0'; +	  if (__radix < 16) +	    return -1; +	  switch (__c) +	  { +	    case 'a': +	    case 'A': +	      return 10; +	    case 'b': +	    case 'B': +	      return 11; +	    case 'c': +	    case 'C': +	      return 12; +	    case 'd': +	    case 'D': +	      return 13; +	    case 'e': +	    case 'E': +	      return 14; +	    case 'f': +	    case 'F': +	      return 15; +	    default: +	      return -1; +	    } +	}      } +#pragma GCC diagnostic pop    template<typename _Bi_iter, typename _Alloc>    template<typename _Out_iter> diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index 1bf98f7..29ecf15 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -2191,6 +2191,15 @@ ftms = {    };  }; +ftms = { +  name = is_implicit_lifetime; +  values = { +    v =  202302; +    cxxmin = 23; +    extra_cond = "__has_builtin(__builtin_is_implicit_lifetime)"; +  }; +}; +  // Standard test specifications.  stds[97] = ">= 199711L";  stds[03] = ">= 199711L"; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 66de8b4..5901d27 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -2455,4 +2455,14 @@  #endif /* !defined(__cpp_lib_philox_engine) */  #undef __glibcxx_want_philox_engine +#if !defined(__cpp_lib_is_implicit_lifetime) +# if (__cplusplus >= 202100L) && (__has_builtin(__builtin_is_implicit_lifetime)) +#  define __glibcxx_is_implicit_lifetime 202302L +#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_implicit_lifetime) +#   define __cpp_lib_is_implicit_lifetime 202302L +#  endif +# endif +#endif /* !defined(__cpp_lib_is_implicit_lifetime) */ +#undef __glibcxx_want_is_implicit_lifetime +  #undef __glibcxx_want_all diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex index 0223066..9121d26 100644 --- a/libstdc++-v3/include/std/regex +++ b/libstdc++-v3/include/std/regex @@ -41,7 +41,6 @@  #include <bitset>  #include <locale> -#include <sstream>  #include <stack>  #include <stdexcept>  #include <string> diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index c064a92..d4db125 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -1984,14 +1984,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION      class tuple<>      {      public: +      // We need the default since we're going to define no-op +      // allocator constructors. +      tuple() = default; +      // Defaulted copy operations to maintain trivial copyability. +      // and support non-const assignment expressions. +      tuple(const tuple&) = default; +      tuple& operator=(const tuple&) = default; +        _GLIBCXX20_CONSTEXPR        void swap(tuple&) noexcept { /* no-op */ } +  #if __cpp_lib_ranges_zip // >= C++23 -      constexpr void swap(const tuple&) const noexcept { /* no-op */ } +      template<same_as<tuple> _Tuple = tuple> +      constexpr const tuple& +      operator=(const _Tuple&) const noexcept +      { return *this; } + +      constexpr void swap(const tuple&) const noexcept +      { /* no-op */ }  #endif -      // We need the default since we're going to define no-op -      // allocator constructors. -      tuple() = default; +        // No-op allocator constructors.        template<typename _Alloc>  	_GLIBCXX20_CONSTEXPR @@ -2001,16 +2014,42 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION  	tuple(allocator_arg_t, const _Alloc&, const tuple&) noexcept { }  #if __cpp_lib_tuple_like // >= C++23 -      // Comparison operators for tuple<> with other empty tuple-like types        template<__tuple_like _UTuple> -	requires (!__is_tuple_v<_UTuple> && tuple_size_v<_UTuple> == 0) +	requires (!is_same_v<remove_cvref_t<_UTuple>, tuple>) +		  && (!is_same_v<remove_cvref_t<_UTuple>, allocator_arg_t>) +		  && (tuple_size_v<remove_cvref_t<_UTuple>> == 0) +      constexpr +      tuple(_UTuple&&) noexcept { } + +      template<typename _Alloc, __tuple_like _UTuple> +	requires (!is_same_v<remove_cvref_t<_UTuple>, tuple>) +		  && (tuple_size_v<remove_cvref_t<_UTuple>> == 0) +      constexpr +      tuple(allocator_arg_t, const _Alloc&, _UTuple&&) noexcept { } + +      template<__tuple_like _UTuple> +	requires (!is_same_v<remove_cvref_t<_UTuple>, tuple>) +		  && (tuple_size_v<remove_cvref_t<_UTuple>> == 0) +      constexpr tuple& +      operator=(_UTuple&&) noexcept +      { return *this; } + +      template<__tuple_like _UTuple> +	requires (!is_same_v<remove_cvref_t<_UTuple>, tuple>) +		  && (tuple_size_v<remove_cvref_t<_UTuple>> == 0) +      constexpr const tuple& +      operator=(_UTuple&&) const noexcept +      { return *this; } + +      template<__tuple_like _UTuple> +	requires (!__is_tuple_v<_UTuple>) && (tuple_size_v<_UTuple> == 0)        [[nodiscard]]        friend constexpr bool        operator==(const tuple&, const _UTuple&) noexcept        { return true; }        template<__tuple_like _UTuple> -	requires (!__is_tuple_v<_UTuple> && tuple_size_v<_UTuple> == 0) +	requires (!__is_tuple_v<_UTuple>) && (tuple_size_v<_UTuple> == 0)        friend constexpr strong_ordering        operator<=>(const tuple&, const _UTuple&) noexcept        { return strong_ordering::equal; } diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 77ebb7e..d28b0773 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -47,6 +47,7 @@  #define __glibcxx_want_is_aggregate  #define __glibcxx_want_is_constant_evaluated  #define __glibcxx_want_is_final +#define __glibcxx_want_is_implicit_lifetime  #define __glibcxx_want_is_invocable  #define __glibcxx_want_is_layout_compatible  #define __glibcxx_want_is_nothrow_convertible @@ -4053,6 +4054,22 @@ template<typename _Ret, typename _Fn, typename... _Args>  # endif  #endif +#ifdef __cpp_lib_is_implicit_lifetime // C++ >= 23 +  /// True if the type is an implicit-lifetime type. +  /// @since C++23 + +  template<typename _Tp> +    struct is_implicit_lifetime +    : bool_constant<__builtin_is_implicit_lifetime(_Tp)> +    { }; + +  /// @ingroup variable_templates +  /// @since C++23 +  template<typename _Tp> +    inline constexpr bool is_implicit_lifetime_v +      = __builtin_is_implicit_lifetime(_Tp); +#endif +  #ifdef __cpp_lib_reference_from_temporary // C++ >= 23 && ref_{converts,constructs}_from_temp    /// True if _Tp is a reference type, a _Up value can be bound to _Tp in    /// direct-initialization, and a temporary object would be bound to | 
