From: Martin Quinson Date: Tue, 8 Jan 2019 07:16:56 +0000 (+0100) Subject: remove any virtuals from Context::StopRequest X-Git-Tag: v3_22~651 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/6146adc437b5b5e57f546b09c26d3392487766b7 remove any virtuals from Context::StopRequest Some clang versions fail otherwise: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/8.2.1/bits/exception_ptr.h:172:9: error: destructor called on non-final 'simgrid::kernel::context::Context::StopRequest' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor] { static_cast<_Ex*>(__x)->~_Ex(); } ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/8.2.1/bits/exception_ptr.h:185:21: note: in instantiation of function template specialization 'std::__exception_ptr::__dest_thunk' requested here __exception_ptr::__dest_thunk<_Ex>); ^ /builds/workspace/SimGrid/build_mode/Debug/node/simgrid-manjaro/build/SimGrid-3.21.90/src/simix/ActorImpl.cpp:507:35: note: in instantiation of function template specialization 'std::make_exception_ptr' requested here actor->throw_exception(std::make_exception_ptr(simgrid::kernel::context::Context::StopRequest("host failed"))); ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/8.2.1/bits/exception_ptr.h:172:34: note: qualify call to silence this warning { static_cast<_Ex*>(__x)->~_Ex(); } ^ 1 error generated. --- diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index a58cf342ec..9a6ace7189 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -86,7 +86,7 @@ public: public: StopRequest() = default; explicit StopRequest(std::string msg) : msg_(std::string("Actor killed (") + msg + std::string(").")) {} - virtual const char* what() const noexcept { return msg_.c_str(); } + const char* what() const noexcept { return msg_.c_str(); } private: std::string msg_ = std::string("Actor killed.");