diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp index 12bd8cc..2aca83f 100644 --- a/include/ghc/filesystem.hpp +++ b/include/ghc/filesystem.hpp @@ -1352,28 +1352,28 @@ using EnableBitmask = typename std::enable_if::value | } // namespace detail template -detail::EnableBitmask operator&(Enum X, Enum Y) +constexpr detail::EnableBitmask operator&(Enum X, Enum Y) { using underlying = typename std::underlying_type::type; return static_cast(static_cast(X) & static_cast(Y)); } template -detail::EnableBitmask operator|(Enum X, Enum Y) +constexpr detail::EnableBitmask operator|(Enum X, Enum Y) { using underlying = typename std::underlying_type::type; return static_cast(static_cast(X) | static_cast(Y)); } template -detail::EnableBitmask operator^(Enum X, Enum Y) +constexpr detail::EnableBitmask operator^(Enum X, Enum Y) { using underlying = typename std::underlying_type::type; return static_cast(static_cast(X) ^ static_cast(Y)); } template -detail::EnableBitmask operator~(Enum X) +constexpr detail::EnableBitmask operator~(Enum X) { using underlying = typename std::underlying_type::type; return static_cast(~static_cast(X)); diff --git a/test/filesystem_test.cpp b/test/filesystem_test.cpp index e9fe2d8..c3df41a 100644 --- a/test/filesystem_test.cpp +++ b/test/filesystem_test.cpp @@ -1145,8 +1145,14 @@ TEST_CASE("30.10.9 class filesystem_error", "[filesystem][filesystem_error][fs.c CHECK(fse.path2() == "some/other"); } +constexpr fs::perms constExprOwnerAll() +{ + return fs::perms::owner_read | fs::perms::owner_write | fs::perms::owner_exec; +} + TEST_CASE("30.10.10.4 enum class perms", "[filesystem][enum][fs.enum]") { + static_assert(constExprOwnerAll() == fs::perms::owner_all, "constexpr didn't result in owner_all"); CHECK((fs::perms::owner_read | fs::perms::owner_write | fs::perms::owner_exec) == fs::perms::owner_all); CHECK((fs::perms::group_read | fs::perms::group_write | fs::perms::group_exec) == fs::perms::group_all); CHECK((fs::perms::others_read | fs::perms::others_write | fs::perms::others_exec) == fs::perms::others_all);