Skip to content

Commit

Permalink
[clang-tidy-19] Enable bugprone-return-const-ref-from-parameter
Browse files Browse the repository at this point in the history
```
error: returning a constant reference parameter may cause use-after-free
when the parameter is constructed from a temporary
[bugprone-return-const-ref-from-parameter,-warnings-as-errors]
  122 |     return value;
      |            ^~~~~
```
  • Loading branch information
alexkaratarakis committed Dec 5, 2024
1 parent 803035d commit cc81a05
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ Checks: >
-bugprone-unchecked-optional-access,
-readability-container-size-empty,
-bugprone-crtp-constructor-accessibility,
-bugprone-return-const-ref-from-parameter,
# Turn all the warnings from the checks above into errors.
WarningsAsErrors: "*"
Expand Down
2 changes: 1 addition & 1 deletion include/fixed_containers/optional_storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ constexpr auto& get(OptionalStorage<T>& value)
template <typename T>
constexpr T&& get(T&& value)
{
return value;
return std::forward<T>(value);
}

// "Transparent" here means there will be no wrapping for simple types.
Expand Down

0 comments on commit cc81a05

Please sign in to comment.