-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Milestone
Description
zig commit: 236db62
fn alert(msg_ptr: [*]const u8, msg_len: usize) void {}
fn asyncFn(a: usize) callconv(.Async) usize {
return a;
}
fn amain() void {
const str = "hello";
var v = async asyncFn(1);
var zero: usize = 0;
alert(str[zero..].ptr, await v);
}
pub fn main() void {
_ = async amain();
}this seems to be caused by the fact that the first parameter of alert is of type [*]const u8. changing the type or removing the first parameter seems to fix the compilation error. assigning the value of the await expression to a temporary variable also fixes the problem.
fn alert(msg_ptr: [*]const u8, msg_len: usize) void {}
fn asyncFn(a: usize) callconv(.Async) usize {
return a;
}
fn amain() void {
const str = "hello";
var v = async asyncFn(1);
var zero: usize = 0;
var tmp = await v;
alert(str[zero..].ptr, tmp);
}
pub fn main() void {
_ = async amain();
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior