SHA256
1
0
forked from pool/libminizinc
libminizinc/0001-Fix-missing-return-in-non-void-function.patch

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