[libcxx-commits] [libcxx] 26005c7 - [libcxx] Make path::format a non-class enum

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Sat Feb 20 14:26:02 PST 2021


Author: Martin Storsjö
Date: 2021-02-21T00:25:54+02:00
New Revision: 26005c788b06755ccafe1205de181bbd8b2ed664

URL: https://github.com/llvm/llvm-project/commit/26005c788b06755ccafe1205de181bbd8b2ed664
DIFF: https://github.com/llvm/llvm-project/commit/26005c788b06755ccafe1205de181bbd8b2ed664.diff

LOG: [libcxx] Make path::format a non-class enum

The spec doesn't declare it as an enum class, and being declared
as an enum class breaks referring to the values as e.g.
path::auto_format.

Differential Revision: https://reviews.llvm.org/D97084

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/libcxx/include/filesystem b/libcxx/include/filesystem
index 2da24d485021..58a1ef239b21 100644
--- a/libcxx/include/filesystem
+++ b/libcxx/include/filesystem
@@ -921,7 +921,7 @@ public:
   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

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
index 83ce692e7280..d0ebf5a1cab4 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
@@ -87,6 +87,9 @@ void RunTestCase(MultiStringType const& MS) {
   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() {

diff  --git a/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp
index f32816783337..210d28af7bd4 100644
--- a/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp
@@ -23,9 +23,7 @@ int main(int, char**) {
   typedef fs::path::format E;
   static_assert(std::is_enum<E>::value, "");
 
-  // 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
 


        


More information about the libcxx-commits mailing list