We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf6c6f1 commit fa960a2Copy full SHA for fa960a2
tests/lit-tests/enum-32bit-limits.ispc
@@ -0,0 +1,14 @@
1
+// RUN: %ispc %s -o %t.o --target=host
2
+
3
+// Regression test for allowing 32-bit enum values with the high bit set.
4
5
+enum Flags {
6
+ FLAG_HIGH_BIT = 0x80000000,
7
+ FLAG_ALL = 0xffffffff
8
+};
9
10
+export uniform int use_enum_values() {
11
+ uniform int a = (int)FLAG_HIGH_BIT;
12
+ uniform int b = (int)FLAG_ALL;
13
+ return a + b;
14
+}
tests/lit-tests/enum-32bit-overflow-error.ispc
@@ -0,0 +1,7 @@
+// RUN: not %{ispc} --nowrap --nostdlib --target=host %s -o - 2>&1 | FileCheck %s
+// CHECK: Error: Enumerator value must be representable with a 32-bit integer.
+enum TooBig {
+ TOO_BIG = 0x100000000
0 commit comments