Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Hide the destructor of resource::Model
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 4 Jun 2019 09:57:18 +0000 (11:57 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 4 Jun 2019 09:57:22 +0000 (11:57 +0200)
If "~Model() = default" is in the header file, the compilation fails
with the following message:

 /usr/include/simgrid/kernel/resource/Model.hpp:35:11:   required from here
 /usr/include/c++/6/bits/unique_ptr.h:74:22: error: invalid application of 'sizeof' to incomplete type 'simgrid::kernel::lmm::System'
   static_assert(sizeof(_Tp)>0,

That's too bad because simgrid::kernel::lmm::System is not a public
type. This fails in particular when compiling simgrid-FMI.

Hiding the destructor in the cpp as done with this commit works better
because lmm::System is visible from Model.cpp

include/simgrid/kernel/resource/Model.hpp
src/kernel/resource/Model.cpp

index 91da47c..a45f4ef 100644 (file)
@@ -32,7 +32,7 @@ public:
   Model(const Model&) = delete;
   Model& operator=(const Model&) = delete;
 
-  virtual ~Model() = default;
+  virtual ~Model();
 
   /** @brief Get the set of [actions](@ref Action) in *inited* state */
   Action::StateSet* get_inited_action_set() { return &inited_action_set_; }
index 5eb87c9..635f0b9 100644 (file)
@@ -13,6 +13,7 @@ namespace kernel {
 namespace resource {
 
 Model::Model(Model::UpdateAlgo algo) : update_algorithm_(algo) {}
+Model::~Model() = default;
 
 Action::ModifiedSet* Model::get_modified_set() const
 {