Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ namespace unit_test
TEST(UT__DepthCounter, MoveAssignment)
{
internal::DepthCounter dc{};
dc.AddArray();
dc.AddValue();
score::cpp::ignore = dc.AddArray();
score::cpp::ignore = dc.AddValue();
auto result = dc.CheckEndOfFile();
ASSERT_EQ(result.error(), JsonErrc::kInvalidJson);
ASSERT_EQ(result.error().UserMessage(),
Expand All @@ -62,8 +62,8 @@ TEST(UT__DepthCounter, MoveAssignment)
TEST(UT__DepthCounter, MoveConstruction)
{
internal::DepthCounter dc{};
dc.AddArray();
dc.AddValue();
score::cpp::ignore = dc.AddArray();
score::cpp::ignore = dc.AddValue();

const auto result = dc.CheckEndOfFile();
ASSERT_EQ(result.error(), JsonErrc::kInvalidJson);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ TEST(UT__JsonOps, ReadStringAbortsOnEmpty)
{
TestStream ts{"Does not matter"};

ASSERT_DEATH(ts.ops.ReadString(""), "JsonOps::ReadString: Cannot check for empty string");
ASSERT_DEATH(score::cpp::ignore = ts.ops.ReadString(""), "JsonOps::ReadString: Cannot check for empty string");
}

/*!
Expand Down
14 changes: 7 additions & 7 deletions score/result/details/expected/expected.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ template <typename E>
// copy assignment operators.
// NOLINTBEGIN(cppcoreguidelines-special-member-functions): shall be implicitly declared as per the C++23 standard.
// coverity[autosar_cpp14_a12_0_1_violation]
class unexpected : impl::base_unexpected
class [[nodiscard]] unexpected : impl::base_unexpected
// NOLINTEND(cppcoreguidelines-special-member-functions): shall be implicitly declared as per the C++23 standard.
{
public:
Expand Down Expand Up @@ -115,24 +115,24 @@ class unexpected : impl::base_unexpected
// NOLINTNEXTLINE(performance-noexcept-move-constructor) qualification from the move assignment operator of E.
constexpr unexpected& operator=(unexpected&&) = default;

constexpr const E& error() const& noexcept
[[nodiscard]] constexpr const E& error() const& noexcept
{
return value_;
}
constexpr E& error() & noexcept
[[nodiscard]] constexpr E& error() & noexcept
{
// coverity[autosar_cpp14_a9_3_1_violation] by design
return value_;
}
constexpr const E&& error() const&& noexcept
[[nodiscard]] constexpr const E&& error() const&& noexcept
{
// Suppress AUTOSAR C++14 A18-9-3" rule violations. The rule states "The std::move shall not be used on objects
// declared const or const&." the move operation on a const object does not cause unintended behavior it ensures
// a proper copy/move of underlying values.
// coverity[autosar_cpp14_a18_9_3_violation]
return std::move(value_);
}
constexpr E&& error() && noexcept
[[nodiscard]] constexpr E&& error() && noexcept
{
return std::move(value_);
}
Expand Down Expand Up @@ -208,7 +208,7 @@ unexpected(E) -> unexpected<E>;
#endif

template <typename T, typename E>
class SPP_EXPECTED_NODISCARD expected : impl::base_expected
class [[nodiscard]] expected : impl::base_expected
{
// Suppress "AUTOSAR C++14 A5-1-7" rule finding. This rule states: "A lambda shall not be an operand to decltype or
// typeid". False-positive, at this point "decltype" is not used with lambda.
Expand Down Expand Up @@ -1031,7 +1031,7 @@ class SPP_EXPECTED_NODISCARD expected : impl::base_expected
};

template <typename E>
class SPP_EXPECTED_NODISCARD expected<void, E> : impl::base_expected
class [[nodiscard]] expected<void, E> : impl::base_expected
{
// Suppress "AUTOSAR C++14 A5-1-7" rule finding. This rule states: "A lambda shall not be an operand to decltype or
// typeid". False-positive, at this point "decltype" is not used with lambda.
Expand Down
Loading