Skip to content

Commit 471b4ac

Browse files
committed
[FIX] missed named return value optimisation
1 parent 6adb061 commit 471b4ac

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

include/sharg/detail/type_name_as_string.hpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,16 @@ inline std::string const type_name_as_string = []()
5454
// We exclude status != 0, because this code can't be reached normally, only if there is a defect in the compiler
5555
// itself, since the type is directly given by the compiler. See https://github.com/seqan/seqan3/pull/2311.
5656
// LCOV_EXCL_START
57-
// clang-format off
5857
if (status != 0)
59-
return std::string{typeid(type).name()} +
60-
" (abi::__cxa_demangle error status (" + std::to_string(status) + "): " +
61-
(status == -1 ? "A memory allocation failure occurred." :
62-
(status == -2 ? "mangled_name is not a valid name under the C++ ABI mangling rules." :
63-
(status == -3 ? "One of the arguments is invalid." : "Unknown Error"))) + ")";
64-
// clang-format on
58+
{
59+
demangled_name =
60+
std::string{typeid(type).name()} + " (abi::__cxa_demangle error status (" + std::to_string(status) + "): "
61+
+ (status == -1 ? "A memory allocation failure occurred."
62+
: (status == -2 ? "mangled_name is not a valid name under the C++ ABI mangling rules."
63+
: (status == -3 ? "One of the arguments is invalid." : "Unknown Error")))
64+
+ ")";
65+
return demangled_name;
66+
}
6567
// LCOV_EXCL_STOP
6668

6769
demangled_name = std::string{std::addressof(*demangled_name_ptr)};

0 commit comments

Comments
 (0)