From 6b2f4fd20d3c85e5db592f76dea8e56da54e9211 Mon Sep 17 00:00:00 2001
From: Vexu
- {#syntax#}T{#endsyntax#} must be a {#syntax#}bool{#endsyntax#}, a float, + {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer or an enum.
{#header_close#} @@ -6899,7 +6899,7 @@ fn func(y: *i32) void { This builtin function atomically modifies memory and then returns the previous value.- {#syntax#}T{#endsyntax#} must be a {#syntax#}bool{#endsyntax#}, a float, + {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer or an enum.
@@ -6925,7 +6925,7 @@ fn func(y: *i32) void { This builtin function atomically stores a value.
- {#syntax#}T{#endsyntax#} must be a {#syntax#}bool{#endsyntax#}, a float, + {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer or an enum.
{#header_close#} @@ -7208,7 +7208,7 @@ fn cmpxchgStrongButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_v more efficiently in machine instructions.- {#syntax#}T{#endsyntax#} must be a {#syntax#}bool{#endsyntax#}, a float, + {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer or an enum.
{#syntax#}@TypeOf(ptr).alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}
@@ -7237,7 +7237,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val However if you need a stronger guarantee, use {#link|@cmpxchgStrong#}.- {#syntax#}T{#endsyntax#} must be a {#syntax#}bool{#endsyntax#}, a float, + {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer or an enum.
{#syntax#}@TypeOf(ptr).alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}
diff --git a/src/ir.cpp b/src/ir.cpp index 9d5814ab6f..efc9cb6707 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -26752,7 +26752,7 @@ static IrInstGen *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstSrcCmpxch if (operand_type->id == ZigTypeIdFloat) { ir_add_error(ira, &instruction->type_value->child->base, - buf_sprintf("expected integer, enum or pointer type, found '%s'", buf_ptr(&operand_type->name))); + buf_sprintf("expected bool, integer, enum or pointer type, found '%s'", buf_ptr(&operand_type->name))); return ira->codegen->invalid_inst_gen; } @@ -30407,7 +30407,7 @@ static ZigType *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstGen *op) { return ira->codegen->builtin_types.entry_invalid; if (operand_ptr_type == nullptr) { ir_add_error(ira, &op->base, - buf_sprintf("expected integer, float, enum or pointer type, found '%s'", + buf_sprintf("expected bool, integer, float, enum or pointer type, found '%s'", buf_ptr(&operand_type->name))); return ira->codegen->builtin_types.entry_invalid; } diff --git a/test/compile_errors.zig b/test/compile_errors.zig index f6e00e1dbb..e4a00e6421 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -899,7 +899,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ _ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst); \\} , &[_][]const u8{ - "tmp.zig:3:22: error: expected integer, enum or pointer type, found 'f32'", + "tmp.zig:3:22: error: expected bool, integer, enum or pointer type, found 'f32'", }); cases.add("atomicrmw with float op not .Xchg, .Add or .Sub",