diff --git a/doc/langref.html.in b/doc/langref.html.in index a8673a3d77..92c1aeba8e 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -5096,7 +5096,7 @@ fn gimmeTheBiggerInteger(a: u64, b: u64) u64 {
For example, if we were to introduce another function to the above snippet:
- {#code_begin|test_err|values of type 'type' must be comptime known#} + {#code_begin|test_err|cannot store runtime value in type 'type'#} fn max(comptime T: type, a: T, b: T) T { return if (a > b) a else b; } diff --git a/src/all_types.hpp b/src/all_types.hpp index 5b75d9f96a..4be6f57593 100644 --- a/src/all_types.hpp +++ b/src/all_types.hpp @@ -335,8 +335,9 @@ struct ConstExprValue { RuntimeHintSlice rh_slice; } data; - ConstExprValue(const ConstExprValue &other) = delete; // plz zero initialize with {} - ConstExprValue& operator= (const ConstExprValue &other) = delete; // use copy_const_val + // uncomment these to find bugs. can't leave them uncommented because of a gcc-9 warning + //ConstExprValue(const ConstExprValue &other) = delete; // plz zero initialize with {} + //ConstExprValue& operator= (const ConstExprValue &other) = delete; // use copy_const_val }; enum ReturnKnowledge { diff --git a/src/codegen.cpp b/src/codegen.cpp index 2e430a60e0..0942c671ff 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -691,7 +691,9 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) { is_definition, scope_line, flags, is_optimized, nullptr); scope->di_scope = ZigLLVMSubprogramToScope(subprogram); - ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram); + if (!g->strip_debug_symbols) { + ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram); + } return scope->di_scope; } case ScopeIdDecls: diff --git a/src/ir.cpp b/src/ir.cpp index 794d41ce22..480493d2ce 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -10726,6 +10726,8 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT } else if (prev_inst->value.type->id == ZigTypeIdOptional) { return prev_inst->value.type; } else { + if ((err = type_resolve(ira->codegen, prev_inst->value.type, ResolveStatusSizeKnown))) + return ira->codegen->builtin_types.entry_invalid; return get_optional_type(ira->codegen, prev_inst->value.type); } } else { @@ -21547,7 +21549,7 @@ static IrInstruction *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstru IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, dest_slice_type, nullptr, true, false); - if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { + if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) { return result_loc; } diff --git a/std/event/lock.zig b/std/event/lock.zig index 6e7a2bbda7..6c2b29b813 100644 --- a/std/event/lock.zig +++ b/std/event/lock.zig @@ -123,8 +123,7 @@ pub const Lock = struct { }; test "std.event.Lock" { - // https://github.com/ziglang/zig/issues/2377 - //if (true) return error.SkipZigTest; + if (builtin.single_threaded) return error.SkipZigTest; const allocator = std.heap.direct_allocator;