* [committed] libstdc++: Fix error in filesystem::path with Clang
@ 2021-10-15 23:49 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-10-15 23:49 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 455 bytes --]
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.
Tested powerpc64le-linux. Committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1324 bytes --]
commit e547d1341b1fe90672c9b982c4a98f8197237bb7
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Oct 15 23:27:54 2021
libstdc++: Fix error in filesystem::path with Clang
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.
diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h
index d13fb12455c..4bd980952f1 100644
--- a/libstdc++-v3/include/bits/fs_path.h
+++ b/libstdc++-v3/include/bits/fs_path.h
@@ -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());
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-15 23:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 23:49 [committed] libstdc++: Fix error in filesystem::path with Clang Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).