From 72b0e467d7f53a80276800d4e0119707c5f58fea Mon Sep 17 00:00:00 2001 From: Infko Date: Wed, 5 Jun 2024 12:16:34 +0800 Subject: [PATCH] fix compile error in gcc 4.8.5. (#133) --- src/symbols/symbols_with_libdwarf.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/symbols/symbols_with_libdwarf.cpp b/src/symbols/symbols_with_libdwarf.cpp index dec70ac..aa41488 100644 --- a/src/symbols/symbols_with_libdwarf.cpp +++ b/src/symbols/symbols_with_libdwarf.cpp @@ -44,13 +44,15 @@ namespace libdwarf { // .emplace needed, for some reason .insert tries to copy <= gcc 7.2 return resolver_map.emplace(object_name, std::move(resolver_object)).first->second.get(); } else { - return resolver_object; + // gcc cannot handle the following logic properly in <= gcc 5.1, so the type to be constructed is explicitly specified. + // See also:https://godbolt.org/z/9oWdWjbf8 + return maybe_owned{std::move(resolver_object)}; } } } // flatten trace with inlines - std::vector flatten_inlines(const std::vector& trace) { + std::vector flatten_inlines(std::vector& trace) { std::vector final_trace; for(const auto& entry : trace) { // most recent call first