Explorar o código

cmext/enum_set: Fix static default construction on older AppleClang versions

AppleClang 8.0 and below do not understand a `= default;` constructor
in static constant default initialization, but do accept `{}`.
Brad King hai 5 meses
pai
achega
2647d97ab7
Modificáronse 2 ficheiros con 8 adicións e 1 borrados
  1. 7 0
      Tests/CMakeLib/testCMExtEnumSet.cxx
  2. 1 1
      Utilities/std/cmext/enum_set

+ 7 - 0
Tests/CMakeLib/testCMExtEnumSet.cxx

@@ -45,6 +45,13 @@ void testDeclaration()
 {
   std::cout << "testDeclaration()" << std::endl;
 
+  {
+    static EnumSetTest const testSet1;
+    static EnumSetTest2 const testSet2;
+    static_cast<void>(testSet1);
+    static_cast<void>(testSet2);
+  }
+
   {
     EnumSetTest testSet1;
     EnumSetTest testSet2 = Test::A;

+ 1 - 1
Utilities/std/cmext/enum_set

@@ -149,7 +149,7 @@ public:
   using reverse_iterator = std::reverse_iterator<iterator>;
   using const_reverse_iterator = std::reverse_iterator<const_iterator>;
 
-  constexpr enum_set() noexcept = default;
+  constexpr enum_set() noexcept {}
   enum_set(key_type e) { this->insert(e); }
   enum_set(enum_set const& other) noexcept { this->insert(other); }
   template <typename E,