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

Ref returns/locals + Local Methods -- No error on "ref void" local methods #8441

Closed
dpoeschl opened this issue Feb 6, 2016 · 4 comments
Closed

Comments

@dpoeschl
Copy link
Contributor

dpoeschl commented Feb 6, 2016

Paste C# code:

class C
{
    void M()
    {
        ref void NoError() { }
    }

    ref void HasError() { } // CS 8898
}

Expected: The ref void local method NoError should be an error, probably with the same error code as the ref void member method HasError
Actual: The ref void local method has no errors, and compilation completes successfully

@dpoeschl
Copy link
Contributor Author

dpoeschl commented Feb 6, 2016

/cc: @VSadov

@dpoeschl
Copy link
Contributor Author

dpoeschl commented Feb 6, 2016

Also /cc: @balajikris

@dpoeschl
Copy link
Contributor Author

dpoeschl commented Feb 6, 2016

The resultant assembly fails PEVerify. I didn't even dare run it. 😄

.method assembly hidebysig static void&  '<M>g__NoError0_0'() cil managed
{
  .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) 
  // Code size       2 (0x2)
  .maxstack  8
  IL_0000:  nop
  IL_0001:  ret
} // end of method C::'<M>g__NoError0_0'

@jaredpar jaredpar added the Bug label Feb 11, 2016
@jaredpar jaredpar added this to the 2.0 (RC) milestone Feb 11, 2016
@VSadov VSadov self-assigned this Feb 19, 2016
VSadov added a commit to VSadov/roslyn that referenced this issue Feb 19, 2016
VSadov added a commit to VSadov/roslyn that referenced this issue Feb 19, 2016
@VSadov
Copy link
Member

VSadov commented Feb 21, 2016

fixed in #8945

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

4 participants