clang-error:fix clang-diagnostic-potentially-evaluated-expression error
This error is generated when expression with side effects is evaluated
despite being used as an operand to 'typeid'.
Change-Id: I72daa47f1c5b05b466e1635fe6d547db4b1da34b
Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>
diff --git a/fw-update/test/package_parser_test.cpp b/fw-update/test/package_parser_test.cpp
index 1720eb8..4984ffd 100644
--- a/fw-update/test/package_parser_test.cpp
+++ b/fw-update/test/package_parser_test.cpp
@@ -26,7 +26,8 @@
constexpr uintmax_t pkgSize = 166;
constexpr std::string_view pkgVersion{"VersionString1"};
auto parser = parsePkgHeader(fwPkgHdr);
- EXPECT_EQ(typeid(*parser).name(), typeid(PackageParserV1).name());
+ auto obj = parser.get();
+ EXPECT_EQ(typeid(*obj).name(), typeid(PackageParserV1).name());
EXPECT_EQ(parser->pkgHeaderSize, fwPkgHdr.size());
EXPECT_EQ(parser->pkgVersion, pkgVersion);
@@ -85,7 +86,8 @@
constexpr uintmax_t pkgSize = 407;
constexpr std::string_view pkgVersion{"VersionString1"};
auto parser = parsePkgHeader(fwPkgHdr);
- EXPECT_EQ(typeid(*parser).name(), typeid(PackageParserV1).name());
+ auto obj = parser.get();
+ EXPECT_EQ(typeid(*obj).name(), typeid(PackageParserV1).name());
EXPECT_EQ(parser->pkgHeaderSize, fwPkgHdr.size());
EXPECT_EQ(parser->pkgVersion, pkgVersion);
@@ -173,7 +175,8 @@
constexpr uintmax_t pkgSize = 166;
constexpr std::string_view pkgVersion{"VersionString1"};
auto parser = parsePkgHeader(fwPkgHdr);
- EXPECT_EQ(typeid(*parser).name(), typeid(PackageParserV1).name());
+ auto obj = parser.get();
+ EXPECT_EQ(typeid(*obj).name(), typeid(PackageParserV1).name());
EXPECT_EQ(parser->pkgHeaderSize, fwPkgHdr.size());
EXPECT_EQ(parser->pkgVersion, pkgVersion);
EXPECT_THROW(parser->parse(fwPkgHdr, pkgSize), std::exception);