[llvm-bugs] [Bug 52536] New: The filesystem::path::format type is not declared correctly.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 17 12:06:45 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=52536

            Bug ID: 52536
           Summary: The filesystem::path::format type is not declared
                    correctly.
           Product: libc++
           Version: 11.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: edward.vogel at hpe.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

It seems that libc++ declares filesystem::path::format as a class.   The
standard requires it to be an enum.  This prevents programs from compiling when
-stdlib=libc++ is used.  Here is a cut/paste from a cygwin session:

$ cat t.cpp
#include <filesystem>
#include <type_traits>
using namespace std;

int main(void)
{
  typedef enum filesystem::path::format T1;
  typedef std::underlying_type<T1>::type T2;
  T1 a;
  T2 b;
  b = a;
}

VogelEd at XLB3502Q4E ~/tests/cppperen2.0
$ clang++ -std=c++17 t.cpp

VogelEd at XLB3502Q4E ~/tests/cppperen2.0
$ clang++ -std=c++17 -stdlib=libc++ t.cpp
t.cpp:11:7: error: assigning to 'T2' (aka 'unsigned char') from incompatible
      type 'T1' (aka 'std::__1::__fs::filesystem::path::format')
  b = a;
      ^
1 error generated.

Visual Studio 2019 also compiles the program.

The (V11) version of filesystem contains:

  enum class _LIBCPP_ENUM_VIS format : unsigned char {
    auto_format,
    native_format,
    generic_format
  };

It seems g++ gets this right.  They have:

    enum format : unsigned char { native_format, generic_format, auto_format };


Not a significant problem, but I wanted to make you aware of it.

Thanks,

Ed Vogel

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211117/38c7ca5a/attachment.html>


More information about the llvm-bugs mailing list