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

[Bug][Crash] Failure during codegen for boxed struct that was returned as generic interface #2165

Open
kallisto56 opened this issue Feb 24, 2025 · 0 comments

Comments

@kallisto56
Copy link
Contributor

Hi there,

Reproducible on latest nightly (1805316) and previous builds.
Ready-for-testing project: bug.2165.zip
While working on the issue #926, I've encountered a situation in which compiler fails during codegen:

Failure during codegen of ?get__mState@?$Box@UDoor@bug2165@bf@@@@QEAA?AW4StateType@bug2165@bf@@XZ
in BOX_bug2165_Door:
Assert 'retCount == 1' failed on line 18284
 MCBlock: entry:0

Excerpt:

class Program
{
	static void Main ()
	{
		IState<StateType> doorState = Build();
		Debug.WriteLine("{}", doorState.mState); // << Failure during codegen
		delete doorState;
	}

	static IState<StateType> Build ()
	{
		return new box Door(.Opened);
	}
}


interface IState<T1>
where T1 :enum
{
	T1 mState { get; set mut; }
}

struct Door : IState<StateType>
{
	public StateType mState { get; set mut; }

	public this (StateType state)
	{
		mState = state;
	}
}

enum StateType
{
	Opened,
	Closed,
}

enum TriggerType
{
	DoorHandle,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant