-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Closed
Copy link
Labels
Area-CompilersBugFeature - Default Interface ImplDefault Interface ImplementationDefault Interface Implementation
Milestone
Description
interface IA
{
static ref int P { get;}
static void Main()
{}
}
IL:
.class interface private auto ansi abstract IA
{
// Fields
.field private static initonly int32 '<P>k__BackingField'
.custom instance void [System.Private.CoreLib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
)
.custom instance void [System.Private.CoreLib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Private.CoreLib]System.Diagnostics.DebuggerBrowsableState) = (
01 00 00 00 00 00 00 00
)
// Methods
.method public hidebysig specialname static
int32& get_P () cil managed
{
.custom instance void [System.Private.CoreLib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
)
// Method begins at RVA 0x2050
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldsfld int32 IA::'<P>k__BackingField'
IL_0005: ret
} // end of method IA::get_P
.method public hidebysig static
void Main () cil managed
{
// Method begins at RVA 0x2057
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method IA::Main
// Properties
.property int32& P()
{
.get int32& IA::get_P()
}
} // end of class IA
Expected an error similar to the one in class: "error CS8145: Auto-implemented properties cannot return by reference"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersBugFeature - Default Interface ImplDefault Interface ImplementationDefault Interface Implementation