File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -875,7 +875,7 @@ class heap_object {
875
875
*data = std::forward<T2>(oth);
876
876
}
877
877
878
- ~heap_object() = default ;
878
+ ~heap_object();
879
879
880
880
auto operator=(heap_object const& oth) -> heap_object& {
881
881
*data = *oth;
@@ -953,6 +953,20 @@ class heap_object {
953
953
for key in self .unionDefinitions :
954
954
self .unionDefinitions [key ].writeDefinition (self .target , " " )
955
955
956
+ # CPP23: std::unique_ptr in heap_object is constexpr.
957
+ # Hence, the compiler will try to instantiate the destructor on definition.
958
+ # If the destructor was defined inside heap_object, other classes would only
959
+ # be forward declared at this point.
960
+ # This results in an error, because the destructor cannot be generated for
961
+ # incomplete types.
962
+ # Therefore, the destructor is defined here, after all classes have been defined.
963
+ self .target .write (
964
+ """template <typename T>
965
+ heap_object<T>::~heap_object() = default;
966
+
967
+ """
968
+ )
969
+
956
970
# write implementations
957
971
for key in self .classDefinitions :
958
972
self .classDefinitions [key ].writeImplDefinition (self .target , "" , " " )
You can’t perform that action at this time.
0 commit comments