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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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@XLB3502Q4E ~/tests/cppperen2.0
$ clang++ -std=c++17 t.cpp

VogelEd@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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to