| author | |
| committer | |
| log | d8da34c64c0def6915cead3e16991ed97515ed71 |
| tree | 010c2f67000a84b9061b5218ef4a95444d320c2e |
| parent | d2b94afaf2383bbcb03ab201e544aa830c082e99 |
closes #2282 files changed, 11 insertions(+), 0 deletions(-)
src/ir.cpp+5| ... | ... | @@ -7591,6 +7591,11 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 7591 | 7591 | var->value.type = result_type; |
| 7592 | 7592 | assert(var->value.type); |
| 7593 | 7593 | |
| 7594 | if (result_type->id == TypeTableEntryIdInvalid) { | |
| 7595 | decl_var_instruction->base.other = &decl_var_instruction->base; | |
| 7596 | return ira->codegen->builtin_types.entry_void; | |
| 7597 | } | |
| 7598 | ||
| 7594 | 7599 | bool is_comptime = ir_get_var_is_comptime(var); |
| 7595 | 7600 | |
| 7596 | 7601 | if (casted_init_value->value.special != ConstValSpecialRuntime) { |
test/run_tests.cpp+6| ... | ... | @@ -1656,6 +1656,12 @@ fn bar() -> i32 { |
| 1656 | 1656 | } |
| 1657 | 1657 | )SOURCE", 1, ".tmp_source.zig:11:9: error: parameter of type '(integer literal)' requires comptime"); |
| 1658 | 1658 | |
| 1659 | add_compile_fail_case("assign too big number to u16", R"SOURCE( | |
| 1660 | fn foo() { | |
| 1661 | var vga_mem: u16 = 0xB8000; | |
| 1662 | } | |
| 1663 | )SOURCE", 1, ".tmp_source.zig:3:24: error: integer value 753664 cannot be implicitly casted to type 'u16'"); | |
| 1664 | ||
| 1659 | 1665 | } |
| 1660 | 1666 | |
| 1661 | 1667 | ////////////////////////////////////////////////////////////////////////////// |