C++: Add a test showing that we infer a lower and upper bound for parameters of enum types.

This commit is contained in:
Mathias Vorreiter Pedersen
2026-02-16 09:38:15 +00:00
parent 84be8517bb
commit bfbb2eef6c
4 changed files with 21 additions and 0 deletions

View File

@@ -1086,6 +1086,7 @@
| test.c:970:12:970:12 | y | 256 |
| test.c:971:9:971:9 | x | 2147483647 |
| test.c:972:9:972:9 | y | 256 |
| test.c:985:7:985:7 | e | -2147483648 |
| test.cpp:10:7:10:7 | b | -2147483648 |
| test.cpp:11:5:11:5 | x | -2147483648 |
| test.cpp:13:10:13:10 | x | -2147483648 |

View File

@@ -4937,6 +4937,13 @@ estimateNrOfBounds
| test.c:970:18:970:20 | 512 | 1.0 |
| test.c:971:9:971:9 | x | 1.0 |
| test.c:972:9:972:9 | y | 1.0 |
| test.c:977:9:977:11 | 1 | 1.0 |
| test.c:978:9:978:11 | 2 | 1.0 |
| test.c:979:9:979:11 | 4 | 1.0 |
| test.c:980:9:980:11 | 8 | 1.0 |
| test.c:981:9:981:12 | 16 | 1.0 |
| test.c:985:7:985:7 | (int)... | 1.0 |
| test.c:985:7:985:7 | e | 1.0 |
| test.cpp:9:11:9:12 | - ... | 1.0 |
| test.cpp:9:12:9:12 | 1 | 1.0 |
| test.cpp:10:7:10:7 | (bool)... | 1.0 |

View File

@@ -972,3 +972,15 @@ void test_overflow() {
out(y);
}
}
enum MY_ENUM_2 {
A = 0x1,
B = 0x2,
C = 0x4,
D = 0x8,
E = 0x10
};
void test_enum(enum MY_ENUM_2 e) {
out(e);
}

View File

@@ -1086,6 +1086,7 @@
| test.c:970:12:970:12 | y | 256 |
| test.c:971:9:971:9 | x | 2147483647 |
| test.c:972:9:972:9 | y | 256 |
| test.c:985:7:985:7 | e | 2147483647 |
| test.cpp:10:7:10:7 | b | 2147483647 |
| test.cpp:11:5:11:5 | x | 2147483647 |
| test.cpp:13:10:13:10 | x | 2147483647 |