]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix error in filesystem::path with Clang
authorJonathan Wakely <jwakely@redhat.com>
Fri, 15 Oct 2021 22:27:54 +0000 (23:27 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 15 Oct 2021 23:44:28 +0000 (00:44 +0100)
THis fixes teh following error seen with Clang:

error: function '_S_convert<std::basic_string_view<char8_t>>' with deduced
return type cannot be used before it is defined
          return string_type(_S_convert(std::u8string_view(__str)));
                             ^

libstdc++-v3/ChangeLog:

* include/bits/fs_path.h (path::_S_convert(T)): Avoid recursive
call to function with deduced return type.

libstdc++-v3/include/bits/fs_path.h

index d13fb12455ceaf152d170d5c904381ed2b4d25ca..4bd980952f1b9de4e01f9410bacd947ed9ba5bf0 100644 (file)
@@ -630,7 +630,8 @@ namespace __detail
          // Calling _S_convert<char8_t> will return a u8string_view that
          // refers to __str and would dangle after this function returns.
          // Return a string_type instead, to avoid dangling.
-         return string_type(_S_convert(std::u8string_view(__str)));
+         return string_type(_S_convert(__str.data(),
+                                       __str.data() + __str.size()));
 #endif
        else
          return _S_convert(__str.data(), __str.data() + __str.size());