diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 60099cc03..7b95da1ad 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -1142,7 +1142,7 @@ gb_internal void check_assignment(CheckerContext *c, Operand *operand, Type *typ if (operand->mode == Addressing_Type && is_type_typeid(type)) { add_type_info_type(c, operand->type); - add_type_and_value(c, operand->expr, Addressing_Value, type, exact_value_typeid(operand->type)); + add_type_and_value(c, operand->expr, Addressing_Constant, type, exact_value_typeid(operand->type)); return; } diff --git a/tests/issues/run.bat b/tests/issues/run.bat index 43a7136b7..11ade8657 100644 --- a/tests/issues/run.bat +++ b/tests/issues/run.bat @@ -37,6 +37,7 @@ set COMMON=-define:ODIN_TEST_FANCY=false -file -vet -strict-style -ignore-unused ..\..\..\odin test ..\test_pr_6476.odin %COMMON% || exit /b ..\..\..\odin check ..\test_issue_6484.odin -no-entry-point %COMMON% || exit /b ..\..\..\odin check ..\test_issue_6874.odin %COMMON% 2>&1 | find /c "Error:" | findstr /x "1" || exit /b +..\..\..\odin check ..\test_issue_6979.odin -no-entry-point %COMMON% || exit /b @echo off diff --git a/tests/issues/run.sh b/tests/issues/run.sh index 3633a7606..4ab2fbd69 100755 --- a/tests/issues/run.sh +++ b/tests/issues/run.sh @@ -79,6 +79,7 @@ else echo "SUCCESSFUL 0/1" exit 1 fi +$ODIN check ../test_issue_6979.odin -no-entry-point $COMMON set +x diff --git a/tests/issues/test_issue_6979.odin b/tests/issues/test_issue_6979.odin new file mode 100644 index 000000000..f13c1f39d --- /dev/null +++ b/tests/issues/test_issue_6979.odin @@ -0,0 +1,7 @@ +// Tests issue https://github.com/odin-lang/Odin/issues/6979 +package test_issues + +error :: proc() -> typeid { + data :: struct{type: typeid}{int} + return data.type +}