forked from pool/libminizinc
21adb52eeb
New package OBS-URL: https://build.opensuse.org/request/show/973118 OBS-URL: https://build.opensuse.org/package/show/science/libminizinc?expand=0&rev=1
29 lines
836 B
Diff
29 lines
836 B
Diff
From 0371e4b46758aa90eb322fc018450b307e65c9da Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
|
Date: Tue, 26 Apr 2022 23:34:06 +0200
|
|
Subject: [PATCH] Fix missing return in non-void function
|
|
|
|
Not returning in a non-void function causes undefined-behavior.
|
|
|
|
An enum in C++ is not closed, but may have any value of its underlying
|
|
type (in this case int).
|
|
---
|
|
lib/model.cpp | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/lib/model.cpp b/lib/model.cpp
|
|
index ba30d4c8..b66d05fe 100644
|
|
--- a/lib/model.cpp
|
|
+++ b/lib/model.cpp
|
|
@@ -167,6 +167,7 @@ bool can_increment_type(const Type& t, PossibleBaseTypes pbt) {
|
|
case PBT_I:
|
|
return false;
|
|
}
|
|
+ throw InternalError("Invalid BaseType");
|
|
}
|
|
void increment_type(Type& t, PossibleBaseTypes pbt) {
|
|
assert(pbt != PBT_I);
|
|
--
|
|
2.35.3
|
|
|