public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/95048] New: wstring-constructor of std::filesystem::path throws for non-ASCII characters
@ 2020-05-11  7:59 kontakt at neonfoto dot de
  2020-05-11 20:49 ` [Bug libstdc++/95048] " redi at gcc dot gnu.org
                   ` (33 more replies)
  0 siblings, 34 replies; 35+ messages in thread
From: kontakt at neonfoto dot de @ 2020-05-11  7:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95048

            Bug ID: 95048
           Summary: wstring-constructor of std::filesystem::path throws
                    for non-ASCII characters
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kontakt at neonfoto dot de
  Target Milestone: ---

When trying to port our Windows application to Linux, I encountered a problem
constructing an instance of std::filesystem::path with a wide-character literal
containing a non-ASCII wchar:

#include <filesystem>

int main()
{
    std::filesystem::path p = L"ä";
}

This builds fine with g++-10 -Wall -Wextra -pedantic -std=c++17 minimal.cpp on
my Ubuntu 18.04 in WSL (using g++ from this ppa:
https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test) but throws an
exception on execution: 

terminate called after throwing an instance of
'std::filesystem::__cxx11::filesystem_error'
  what():  filesystem error: Cannot convert character sequence: Invalid or
incomplete multibyte or wide character

Reading the C++ standard, I believe this should not happen and libstdc++ should
be able to convert the wchar literal to a path. Using clang with libc++ instead
of libstdc++ performs a conversion as I expected. Trying different versions of
g++ in the Compiler Explorer (https://godbolt.org/z/KQD1I6) shows that this
also used to work with g++9.1 and stopped working in g++9.2.

The problem was already described by someone else in this StackOverflow post:
https://stackoverflow.com/questions/58521857/cross-platform-way-to-handle-stdstring-stdwstring-with-stdfilesystempath

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2023-07-12 20:24 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11  7:59 [Bug libstdc++/95048] New: wstring-constructor of std::filesystem::path throws for non-ASCII characters kontakt at neonfoto dot de
2020-05-11 20:49 ` [Bug libstdc++/95048] " redi at gcc dot gnu.org
2020-05-11 20:59 ` carlos at redhat dot com
2020-05-11 21:14 ` [Bug libstdc++/95048] [9/10/11 Regression] " redi at gcc dot gnu.org
2020-05-11 21:19 ` redi at gcc dot gnu.org
2020-05-11 21:25 ` redi at gcc dot gnu.org
2020-06-26 12:05 ` rguenth at gcc dot gnu.org
2020-11-12 13:48 ` gcc-bugzilla at m dot chronial.de
2020-11-12 13:58 ` redi at gcc dot gnu.org
2020-11-12 14:02 ` redi at gcc dot gnu.org
2020-11-12 23:49 ` gcc-bugzilla at m dot chronial.de
2021-01-14  8:44 ` rguenth at gcc dot gnu.org
2021-04-19 10:40 ` redi at gcc dot gnu.org
2021-06-01  8:17 ` [Bug libstdc++/95048] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-07-23 12:40 ` gcc-bugzilla at m dot chronial.de
2021-10-19 13:25 ` redi at gcc dot gnu.org
2022-05-27  9:42 ` [Bug libstdc++/95048] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:40 ` jakub at gcc dot gnu.org
2022-10-24 15:09 ` ulf.lorenz at ptvgroup dot com
2022-10-25 11:54 ` redi at gcc dot gnu.org
2022-10-25 12:47 ` ulf.lorenz at ptvgroup dot com
2022-11-11 17:43 ` cvs-commit at gcc dot gnu.org
2022-11-11 17:46 ` [Bug libstdc++/95048] [10/11/12 " redi at gcc dot gnu.org
2022-11-11 17:51 ` redi at gcc dot gnu.org
2022-11-11 22:29 ` cvs-commit at gcc dot gnu.org
2022-11-14 18:34 ` cvs-commit at gcc dot gnu.org
2022-11-22 11:51 ` [Bug libstdc++/95048] [10/11 " ulf.lorenz at ptvgroup dot com
2022-11-22 12:30 ` redi at gcc dot gnu.org
2023-07-07 10:37 ` [Bug libstdc++/95048] [11 " rguenth at gcc dot gnu.org
2023-07-10 15:47 ` cvs-commit at gcc dot gnu.org
2023-07-12 20:04 ` cvs-commit at gcc dot gnu.org
2023-07-12 20:16 ` cvs-commit at gcc dot gnu.org
2023-07-12 20:19 ` cvs-commit at gcc dot gnu.org
2023-07-12 20:23 ` cvs-commit at gcc dot gnu.org
2023-07-12 20:24 ` redi at gcc dot gnu.org

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).