google / google/or-tools

Missing return in model_storage_v2.h for non-void methods

Open
#5,136 0 comments 0 reactions 1 assignee Claimed by @Mizux View on GitHub
Bug Solver: MathOpt
Dominant language
C++
Stars
14.1k
Forks
2.5k
Avg merge
8h 39m
Merged PRs (30d)
72

Description

Version: main/v9.15

https://github.com/google/or-tools/blob/79e340fd50e1cae499bd6c9035486cf06c8261a5/ortools/math_opt/storage/model_storage_v2.h#L1128-L1132

Although LOG(FATAL) aborts, this is not visible for the compiler, and thus compilations fails with `-Werror=return-type`:

```
/home/abuild/rpmbuild/BUILD/google-or-tools-9.15-build/or-tools-9.15/ortools/math_opt/storage/model_storage_v2.h:1132:1: error: no return statement in function returning non-void [-Werror=return-type]
```

The code should be annotated with std::unreachable (C++23) or `__builtin_unreachable` (GCC/LLVM), `__assume(false)` (MSVC).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.