[libcxx-commits] [PATCH] D97084: [libcxx] Make path::format a non-class enum

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 19 13:29:28 PST 2021


mstorsjo created this revision.
mstorsjo added reviewers: libc++, ldionne, curdeius.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.

The spec doesn't declare it as an enum class (as far as I can read the spec - hopefully someone can doublecheck my reading of it), and being declared as an enum class breaks referring to the values as e.g. `path::auto_format`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97084

Files:
  libcxx/include/filesystem
  libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
  libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp


Index: libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp
+++ libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp
@@ -25,7 +25,6 @@
 
   // Check that E is a scoped enum by checking for conversions.
   typedef std::underlying_type<E>::type UT;
-  LIBCPP_STATIC_ASSERT(!std::is_convertible<E, UT>::value, "");
 
   LIBCPP_ONLY(static_assert(std::is_same<UT, unsigned char>::value, "")); // Implementation detail
 
Index: libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
+++ libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
@@ -87,6 +87,9 @@
   RunTestCaseImpl<CharT>(MS, fs::path::format::auto_format);
   RunTestCaseImpl<CharT>(MS, fs::path::format::native_format);
   RunTestCaseImpl<CharT>(MS, fs::path::format::generic_format);
+  RunTestCaseImpl<CharT>(MS, fs::path::auto_format);
+  RunTestCaseImpl<CharT>(MS, fs::path::native_format);
+  RunTestCaseImpl<CharT>(MS, fs::path::generic_format);
 }
 
 void test_sfinae() {
Index: libcxx/include/filesystem
===================================================================
--- libcxx/include/filesystem
+++ libcxx/include/filesystem
@@ -921,7 +921,7 @@
   typedef basic_string<value_type> string_type;
   typedef basic_string_view<value_type> __string_view;
 
-  enum class _LIBCPP_ENUM_VIS format : unsigned char {
+  enum _LIBCPP_ENUM_VIS format : unsigned char {
     auto_format,
     native_format,
     generic_format


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97084.325079.patch
Type: text/x-patch
Size: 1830 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210219/6801088b/attachment-0001.bin>


More information about the libcxx-commits mailing list