mirror of
https://github.com/ziglang/zig.git
synced 2026-02-19 15:58:50 +00:00
* fix issue #5618 * A test for the issue #5618 added. Also inserted a comma in the neighboring test to make it more zigfmt-friendly.
This commit is contained in:
parent
2fde8249b7
commit
78d8931647
@ -15452,6 +15452,7 @@ static IrInstGen *ir_analyze_cast(IrAnalyze *ira, IrInst *source_instr,
|
||||
if (is_pointery_and_elem_is_not_pointery(actual_type)) {
|
||||
ZigType *dest_ptr_type = nullptr;
|
||||
if (wanted_type->id == ZigTypeIdPointer &&
|
||||
actual_type->id != ZigTypeIdOptional &&
|
||||
wanted_type->data.pointer.child_type == ira->codegen->builtin_types.entry_c_void)
|
||||
{
|
||||
dest_ptr_type = wanted_type;
|
||||
|
||||
@ -7571,6 +7571,16 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
\\ return -y;
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:3:12: error: negation of type 'u32'"
|
||||
"tmp.zig:3:12: error: negation of type 'u32'",
|
||||
});
|
||||
|
||||
cases.add("Issue #5618: coercion of ?*c_void to *c_void must fail.",
|
||||
\\export fn foo() void {
|
||||
\\ var u: ?*c_void = null;
|
||||
\\ var v: *c_void = undefined;
|
||||
\\ v = u;
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:4:9: error: expected type '*c_void', found '?*c_void'",
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user