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

Avoid unreachable code error #65

Merged
merged 2 commits into from
Mar 16, 2021
Merged

Conversation

UplinkCoder
Copy link
Contributor

An error complaining about m_union not being set cropped up in our codebase.
This change fixes it by putting the case in which it is not set at the end

An error complaining about m_union not being set cropped up in our codebase.
This change fixes it by putting the case in which it is not set at the end
@s-ludwig
Copy link
Owner

s-ludwig commented Mar 1, 2021

Thanks! Am I right that this is just some implementation detail (bug) in DMD that makes the difference here? I would suggest to add a small comment, so that this doesn't accidentally get broken in the future (a unit test would be even better, of course).

@andralex
Copy link

andralex commented Mar 1, 2021

Looks like a problem with the compiler, the position of the default label shouldn't influence anything.

@UplinkCoder
Copy link
Contributor Author

@andralex yes this is where the reality of the language implementation and the spec differ.

In this case, the "stage" at which the unreachable assert(0) is introduced it changes the outcome of the control-flow analysis.
@s-ludwig I am thinking about how to word the comment properly.

@andralex
Copy link

andralex commented Mar 1, 2021

Submitted https://issues.dlang.org/show_bug.cgi?id=21671 so it doesn't get forgotten.

Co-authored-by: Sönke Ludwig <sludwig@rejectedsoftware.com>
@UplinkCoder
Copy link
Contributor Author

@s-ludwig I've applied your suggestion.
Thanks!

@PetarKirov
Copy link

Ping @s-ludwig @l-kramer

@s-ludwig
Copy link
Owner

Okay, thanks! Sorry for the delay, I missed the last update. Will tag a release afterwards.

@s-ludwig s-ludwig merged commit 865c72f into s-ludwig:master Mar 16, 2021
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

Successfully merging this pull request may close these issues.

4 participants