Skip to content

pragma(inline) ignored in template mixin declaration initializers #23766

Description

@limepoutine
mixin template withBoilerplate(alias dg)
{
    static if (is(typeof(dg()) ReturnType == void))
    {
        typeof(null) withBoilerplateResult = {
            pragma(inline, true);
            dg();
            return null;
        }();
    }
    else
    {
        ReturnType withBoilerplateResult = {
            pragma(inline, true);
            ReturnType value = dg();
            return value;
        }();
    }
}

void main() {
  mixin withBoilerplate!({});
}

Compile with -wi, no inlining and no diagnostics.

FuncExp in these initializers do not go in fd.localsymtab. Fixing this also requires relaxing some of the inlining constraints, but that would be mostly trivial.

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions