Skip to content

#nullable enable causes bogus cycle in struct layout error #32934

@tristanlabelle

Description

@tristanlabelle

Version Used: VS2019 Preview 2

Steps to Reproduce:

  1. Create a new .NET core C# library project
  2. Change the C# language version to 8.0
  3. Type the following code
#nullable enable
struct Foo<T>
{
	static Foo<T> Bar;
}

Expected Behavior: Code compiles fine whether or not #nullable enable is used
Actual Behavior: With #nullable enable the compiler emits this error:

Error CS0523: Struct member 'Foo<T>.Bar' of type 'Foo<T>' causes a cycle in the struct layout

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions