Skip to content

Self-hosted treats *VaList different than LLVM does #24692

@elpekenin

Description

@elpekenin

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 @cVaArg needs to work here universally, or it needs to error here universally

Expected Behavior

Behavior matching between backends

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-x86_6464-bit x86backend-self-hostedbugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions