Skip to content

A7-1-2: Qualifier cannot be declared constexpr #85

@jsinglet

Description

@jsinglet

Affected rules

  • A7-1-2

Description

False positive reported for the following test case. In the example, below, a712 must be constexpr for value to be declared constexpr. However, it is not possible to declare parameters (easily) as constexpr. The mitigation for this issue is likely that cases where it is not possible to declare the qualifier as constexpr.

Example

class A7_1_2 {
 public:
  constexpr auto GetValue() const noexcept { return value_; }
  void SetValue(int32_t value) noexcept { value_ = value; }
 private:
  int32_t value_;
};
std::ostream &operator<<(std::ostream &os, const A7_1_2 a712) noexcept {
  const auto value = a712.GetValue(); // Variable value could be marked 'constexpr'.
  os << value;
  return os;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty-MediumA false positive or false negative report which is expected to take 1-5 days effort to addressImpact-MediumStandard-AUTOSARfalse positive/false negativeAn issue related to observed false positives or false negatives.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions