There was an error while loading. Please reload this page.
1 parent 0e2f10a commit 0c01e74Copy full SHA for 0c01e74
1 file changed
core/include/gz/msgs/detail/dynamic_message_cast.hh
@@ -37,7 +37,12 @@ template<typename MsgT>
37
std::unique_ptr<MsgT>
38
dynamic_message_cast(std::unique_ptr<google::protobuf::Message> &&_baseMsg)
39
{
40
+#if GOOGLE_PROTOBUF_VERSION >= 5028000
41
+ auto converted = std::unique_ptr<MsgT>{
42
+ google::protobuf::DynamicCastMessage<MsgT>(_baseMsg.get())};
43
+#else
44
auto converted = std::unique_ptr<MsgT>{dynamic_cast<MsgT*>(_baseMsg.get())};
45
+#endif
46
if (converted) {
47
// transfer ownership to a new unique_ptr object by releasing from old one
48
(void) _baseMsg.release();
0 commit comments