diff --git a/src/check_type.cpp b/src/check_type.cpp index 14da12340..c5f78fd57 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1368,7 +1368,7 @@ gb_internal void check_bit_set_type(CheckerContext *c, Type *type, Type *named_t gb_free(a, s.text); return; } - if (!check_representable_as_constant(c, iv, t, nullptr)) { + if (!check_representable_as_constant(c, jv, t, nullptr)) { gbAllocator a = heap_allocator(); String s = big_int_to_string(a, &j); gbString ts = type_to_string(t); diff --git a/tests/issues/run.sh b/tests/issues/run.sh index c4dae65f9..393bd1eda 100755 --- a/tests/issues/run.sh +++ b/tests/issues/run.sh @@ -107,6 +107,13 @@ else exit 1 fi +if [[ $($ODIN check ../test_issue_7304.odin -no-entry-point $COMMON_CHECK 2>&1 >/dev/null | grep -c "9223372036854775808 is not representable by int") -eq 1 ]]; then + echo "SUCCESSFUL 1/1" +else + echo "SUCCESSFUL 0/1" + exit 1 +fi + clang -c ../test_issue_7010.c -o test_issue_7010_c.o $ODIN test ../test_issue_7010.odin $COMMON diff --git a/tests/issues/test_issue_7304.odin b/tests/issues/test_issue_7304.odin new file mode 100644 index 000000000..c96a0bae2 --- /dev/null +++ b/tests/issues/test_issue_7304.odin @@ -0,0 +1,4 @@ +// Tests issue #7304 https://github.com/odin-lang/Odin/issues/7304 +package test_issues + +Bad_Bit_Set :: bit_set[-1 ..< 9223372036854775808]