diff --git a/.gitignore b/.gitignore index b867398c4..3c1b8cb78 100644 --- a/.gitignore +++ b/.gitignore @@ -277,6 +277,8 @@ odin *.bin demo.bin libLLVM*.so* +*.a +*.o # core:rexcode commits its generated encode/decode tables: each arch's tablegen # emits human-readable Odin, serialized to tables/*.bin, which the library @@ -321,5 +323,3 @@ build/ cmake-build*/ CMakeLists.txt sandbox/ - -vendor/box3d/lib/box3d_wasm.o diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 937a0eb07..5175ef58c 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7008,6 +7008,18 @@ gb_internal CallArgumentError check_call_arguments_internal(CheckerContext *c, A } } + // an `asm` template's `$` parameter is encoded as an immediate, so only a constant can reach it + if (e && e->kind == Entity_Variable && (e->flags & EntityFlag_PolyConst)) { + if (o->mode != Addressing_Constant) { + if (show_error) { + gbString str = expr_to_string(o->expr); + error(o->expr, "Expected a constant value for the '$' immediate '%.*s', got %s", LIT(e->token.string), str); + gb_string_free(str); + } + err = CallArgumentError_NoneConstantParameter; + } + } + if (e && e->kind == Entity_Constant && is_type_proc(e->type)) { bool ok = false; if (o->mode == Addressing_Constant) {