Skip to content

Missing return in model_storage_v2.h for non-void methods #5136

@StefanBruens

Description

@StefanBruens

Version: main/v9.15

template <typename IdType>
std::vector<VariableId> ModelStorageV2::VariablesInConstraint(
const IdType) const {
LOG(FATAL) << "not implementable for ModelStorageV2";
}

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).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions