Skip to content

[std.traits] SetFunctionAttributes converts Varadic.d functions to Varadic.typesafe functions #11004

Description

@ichordev

Using SetFunctionAttributes on a D-style varadic function with at least one non-variadic parameter causes it to turn the last non-variadic parameter into a typesafe varadic parameter:

import std.traits;
void fn(int a, ...){}
alias Fn = typeof(fn);
//this should be exactly the same as `Fn`, right?
alias Fn2 = SetFunctionAttributes!(Fn, "D", functionAttributes!Fn);
//NOPE! Because it has actually been turned into a typesafe varadic function!
static assert(is(Fn2 == typeof(*void function(int...))));

This is because the mixin generator inside SetFunctionAttributes just appends "..." when it detects D-style variadic linkage, which fails to account for functions with multiple parameters.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions