public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99805] New: filesystem::path::parent_path got a wrong path
@ 2021-03-29  3:05 drfeng08 at gmail dot com
  2021-03-29 15:15 ` [Bug c++/99805] " redi at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: drfeng08 at gmail dot com @ 2021-03-29  3:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99805
           Summary: filesystem::path::parent_path got a wrong path
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drfeng08 at gmail dot com
  Target Milestone: ---

[work@centos7 ~]$ uname -a
Linux centos7 3.10.0-1160.11.1.el7.x86_64 #1 SMP Fri Dec 18 16:34:56 UTC 2020
x86_64 x86_64 x86_64 GNU/Linux
[work@centos7 ~]$ g++ --version
g++ (GCC) 10.2.1 20200804 (Red Hat 10.2.1-2)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[work@centos7 ~]$ which g++
/opt/rh/devtoolset-10/root/usr/bin/g++
[work@centos7 ~]$ cat ans8.cpp
#include <iostream>
#include <filesystem>
#include <string>

std::string get_path() {
    static std::string path = "/ssd1/opt/stdpain/workspace";
    return path;
}

int main() {
    std::filesystem::path path(get_path());
    std::filesystem::path path2 = path.parent_path();
    std::cout << path << std::endl;
    std::cout << path2 << std::endl;
}

output:
/ssd1/opt/stdpain/workspace
/ssd1/opt/stdpain/workspace

expect:
/ssd1/opt/stdpain/workspace
/ssd1/opt/stdpain/

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

end of thread, other threads:[~2021-04-19 11:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29  3:05 [Bug c++/99805] New: filesystem::path::parent_path got a wrong path drfeng08 at gmail dot com
2021-03-29 15:15 ` [Bug c++/99805] " redi at gcc dot gnu.org
2021-04-01  6:15 ` drfeng08 at gmail dot com
2021-04-01 18:02 ` redi at gcc dot gnu.org
2021-04-01 18:03 ` [Bug c++/99805] [9/10/11 Regression] " redi at gcc dot gnu.org
2021-04-01 20:46 ` redi at gcc dot gnu.org
2021-04-01 21:06 ` redi at gcc dot gnu.org
2021-04-07 15:40 ` cvs-commit at gcc dot gnu.org
2021-04-07 15:43 ` [Bug c++/99805] [9/10 " redi at gcc dot gnu.org
2021-04-08 17:00 ` cvs-commit at gcc dot gnu.org
2021-04-08 17:04 ` [Bug c++/99805] [9 " redi at gcc dot gnu.org
2021-04-19 11:31 ` cvs-commit at gcc dot gnu.org
2021-04-19 11:31 ` 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).