Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit struct initialization: handle fields at any depth? #59890

Open
RikkiGibson opened this issue Mar 2, 2022 · 1 comment
Open

Implicit struct initialization: handle fields at any depth? #59890

RikkiGibson opened this issue Mar 2, 2022 · 1 comment
Assignees
Labels
Area-Compilers Code Gen Quality Room for improvement in the quality of the compiler's generated code
Milestone

Comments

@RikkiGibson
Copy link
Contributor

The current implementation of implicit struct initialization in #59788 only initializes fields directly contained in 'this', but it's possible that it's more optimal to initialize nested fields in some scenarios.

SharpLab

using System;

public struct Pair
{
    public int X, Y;
}

public struct S {
    public Pair Pair;
    
    public S()
    {
        // Here we insert `Pair = default;` but we could perhaps insert `Pair.Y = default;`
        Pair.X = 42;
    }
}
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 2, 2022
@RikkiGibson RikkiGibson self-assigned this Mar 2, 2022
@RikkiGibson RikkiGibson added the Code Gen Quality Room for improvement in the quality of the compiler's generated code label Mar 2, 2022
@jcouv jcouv added this to the Compiler.Next milestone Mar 3, 2022
@jcouv
Copy link
Member

jcouv commented Mar 3, 2022

From chat with Rikki, triaged this into Compiler.Next milestone. Let's do a quick test/benchmark. Depending on the evaluation, we can address or close.

@jcouv jcouv removed the untriaged Issues and PRs which have not yet been triaged by a lead label Mar 3, 2022
@jaredpar jaredpar modified the milestones: Compiler.Next, Backlog Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Code Gen Quality Room for improvement in the quality of the compiler's generated code
Projects
None yet
Development

No branches or pull requests

3 participants