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

Defining System.Void in compilation suppresses error about usage of System.Void #61500

Open
RikkiGibson opened this issue May 25, 2022 · 2 comments

Comments

@RikkiGibson
Copy link
Contributor

Version Used: e6b5dd8

Steps to Reproduce:

SharpLab

using System;

namespace System
{
    public class Void { } // comment out to get an error instead of a warning
}

public class C {
    public void M(Void v) {  // warning CS0436: The type 'Void' in '_' conflicts with the imported type 'void'
    }
}

Expected Behavior: An error is reported regardless of whether Void is defined in source.

Actual Behavior: An error is only reported when Void is not defined in source.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels May 25, 2022
@jcouv jcouv added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels May 27, 2022
@jcouv jcouv added this to the Backlog milestone May 27, 2022
@jcouv
Copy link
Member

jcouv commented May 27, 2022

Good find.
However, this is likely an old issue and seems niche. Moving to backlog. Feel free to raise priority if appropriate.

@gafter
Copy link
Member

gafter commented Jul 10, 2022

I suspect this is not a bug. Defining your own System.Void doesn't define the one that void refers to - that type is always the System.Void that comes from the "core library". (Your assembly isn't the core library)

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

No branches or pull requests

3 participants