Commit 33f996bb16
Changed files (5)
doc/langref.html.in
@@ -5096,7 +5096,7 @@ fn gimmeTheBiggerInteger(a: u64, b: u64) u64 {
<p>
For example, if we were to introduce another function to the above snippet:
</p>
- {#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;
}
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 {
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:
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;
}
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;