-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Zig Version
0.15.0-dev.1092+d772c0627
Steps to Reproduce and Observed Behavior
I've noticed that compiler doesn't like an argument of type *VaList in a "normal" function. That is, when breaking some of my code into smaller pieces, compiler complained:
src/root.zig:186:1: error: auto does not support var args
fn printChar(writer: *Writer, ap: *VaList, _: Specifier) Writer.Error!void {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Which, at the very least, is not a very readable message. Wording makes it seems like i tried using ..., which I don't.
My rough understanding is that the problem is not the passing of a *VaList argument, but the related builtins (mostly @cVaArg) emitting different code depending on the calling convention used in the function and auto having no specific information in that regard.
Took the question to discord for a better understanding. After seeing that LLVM backend has no issue with this snippet, @mlugg suggested reporting this as a bug report because:
behavior shouldn't differ between backends; either
@cVaArgneeds to work here universally, or it needs to error here universally
Expected Behavior
Behavior matching between backends