public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* g++ and c++17 filesystem
@ 2020-11-17 15:15 sten.kristian.ivarsson
  2020-11-17 16:45 ` René Berber
  0 siblings, 1 reply; 36+ messages in thread
From: sten.kristian.ivarsson @ 2020-11-17 15:15 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1900 bytes --]

Hi folks

The filesystem-library as a part of C++17 seems to have some defects and
flaws in the cygwin-package and pretty much every lexical- and canonical
operation works in mysterious ways (or not at all)


Following output with g++cygwin

 $ uname -a
 CYGWIN_NT-10.0 JOKK 3.1.7(0.340/5/3) 2020-08-22 17:48 x86_64 Cygwin

 $ g++ --version
 g++ (GCC) 10.2.0
 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.

 $ g++ -std=c++17 main.cpp

 $ ./a.exe
 true
 C:/Temp
 filesystem error: cannot make canonical path: No such file or directory
[C:/Temp]


Following output with mingw (that also is a bit strange (note the last
"generic" (i.e. posix) output))

 $ .\g++.exe --version
 g++.exe (MinGW.org GCC Build-2) 9.2.0
 Copyright (C) 2019 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.

 $ .\g++.exe -std=c++17 main.cpp 

 $ .\a.exe
 true
 C:/Temp
 C:\Temp


Following output with cl (that seems to be the most standard-conformant)

 C:\>cl /std:c++17 main.cpp
 Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x86
 Copyright (C) Microsoft Corporation.  All rights reserved.

 main.cpp

 /out:main.exe
 main.obj

 C:\>main.exe
 true
 C:/Temp
 C:/Temp



I have failed to find out exactly where the defect are though and I also do
have a hard time to see where/how/if there's a gcc/g++/mingw- or
libstdc++-fork for the cygwin package where this breaks


Does anyone have any ideas about this and know of any patches or (hot)fixes
to this ? 

I haven't tried out all the mingw generic/lexical/canonical functions yet,
but maybe they're flawed as well


Thanx in advance



Best regards,
Kristian





[-- Attachment #2: main.cpp --]
[-- Type: text/plain, Size: 549 bytes --]

#include <filesystem>
#include <iostream>
#include <stdexcept>

// g++ -std=c++17 main.cpp


int main()
{

   try
   {
      const std::filesystem::path path{"C:\\Temp"};
      std::cout << std::boolalpha << std::filesystem::exists(path) << std::noboolalpha << std::endl;
      std::cout << path.generic_u8string() << std::endl;
      std::cout << std::filesystem::canonical(path).generic_u8string() << std::endl;
   }
   catch(const std::exception& e)
   {
      std::cerr << e.what() << std::endl;
   }


   return 0;
}


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

end of thread, other threads:[~2020-11-25  9:00 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 15:15 g++ and c++17 filesystem sten.kristian.ivarsson
2020-11-17 16:45 ` René Berber
2020-11-18  9:00   ` Sv: " sten.kristian.ivarsson
2020-11-18 16:24     ` René Berber
2020-11-18 16:31       ` Eliot Moss
2020-11-18 20:46       ` Kristian Ivarsson
2020-11-18 20:56         ` Eliot Moss
2020-11-18 21:18           ` Kristian Ivarsson
2020-11-18 23:47             ` Eliot Moss
2020-11-19  8:10               ` Sv: " sten.kristian.ivarsson
2020-11-18 21:45         ` Norton Allen
2020-11-19  0:08         ` Doug Henderson
2020-11-19  6:23           ` Brian Inglis
2020-11-19 10:03         ` Sv: " sten.kristian.ivarsson
2020-11-19 15:27           ` Brian Inglis
2020-11-20  9:37             ` Sv: " sten.kristian.ivarsson
2020-11-20 15:29               ` Brian Inglis
2020-11-20 16:11                 ` Sv: " sten.kristian.ivarsson
2020-11-19 15:36           ` Eliot Moss
2020-11-20  8:31             ` Sv: " sten.kristian.ivarsson
2020-11-20 18:28               ` Jonathan Yong
     [not found]                 ` <000601d6c173$aa55d540$ff017fc0$@gmail.com>
2020-11-23 11:09                   ` Sv: " Jonathan Yong
2020-11-24  9:32                     ` Sv: " sten.kristian.ivarsson
2020-11-24 10:24                       ` Jonathan Yong
2020-11-24 11:35                         ` Sv: " sten.kristian.ivarsson
2020-11-24 12:33                           ` Jonathan Yong
2020-11-24 14:01                             ` Sv: " sten.kristian.ivarsson
2020-11-25  2:25                               ` Jonathan Yong
2020-11-24 13:22                       ` Eliot Moss
2020-11-24 14:31                         ` Sv: " sten.kristian.ivarsson
2020-11-24 20:06                           ` Ken Brown
2020-11-24 20:39                             ` Eliot Moss
2020-11-25  8:02                               ` Sv: " sten.kristian.ivarsson
2020-11-25  8:30                             ` sten.kristian.ivarsson
2020-11-25  0:23                           ` Brian Inglis
2020-11-25  9:00                             ` Sv: " sten.kristian.ivarsson

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