Fix compiler warnings (-Wdangling-reference)

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
This commit is contained in:
Ferry Huberts 2023-08-16 20:30:22 +02:00
parent 96bff7a7ed
commit 9f97e4ae61
2 changed files with 1 additions and 4 deletions

View File

@ -274,8 +274,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
add_compiler_flags(4.8 "-Wno-suggest-attribute=format")
add_compiler_flags(9.1 "-Wno-pessimizing-move")
add_compiler_flags(13.0 "-Wno-dangling-reference")
endif (CMAKE_CXX_COMPILER_ID MATCHES GNU)

View File

@ -495,8 +495,7 @@ Void EnumInterpreterAsString<T, notnull>::fromInterpretation(const Void& interVa
}
try {
const auto &entry = EnumOW::getEntryByName(interValue.template cast<String>());
return EnumOW(entry.value);
return EnumOW(EnumOW::getEntryByName(interValue.template cast<String>()).value);
} catch (const std::runtime_error&) { // TODO - add a specific error for this.
error = EnumInterpreterError::ENTRY_NOT_FOUND;
}