-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
fix Issue 21492 - betterC: TypeInfo is generated for code guarded by … #14830
Conversation
|
Thanks for your pull request, @WalterBright! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#14830" |
|
This is failing to compile d_test_run.d with an assert failure: It would be better if the test runner is compiled with the bootstrap compiler, so the compiler tests can be run. |
84977e7
to
4d7a984
Compare
4d7a984
to
f90b298
Compare
| case 1: | ||
| if (__ctfe) | ||
| { | ||
| { int[] foo = [1]; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use correct indentation.
|
The Cybershadow failure appears to be a heisenbug. This PR is ready to go. |
|
Do we really need more special cases? |
|
This PR caused a regression https://issues.dlang.org/show_bug.cgi?id=23710 |
|
Regression fix #14916 |
…if(__ctfe)
Code protected by
if (__ctfe)need not have any code generated for it, as illustrated by the bug report. Generating code for it anyway will trigger an error that certain things are not allowed in -betterC code, but are allowed in ctfe code.Normally, the backend will do just fine eliminating such dead code. But the error detection occurs before the backend. To do it thoroughly in the front end requires data flow analysis. But that's awful expensive for just this problem. So this PR implements a rather primitive method which will handle the usual cases. The cases it doesn't handle (and such can be easily contrived) will still trigger the error. But such are easily rewritten into the form that is accepted, so nothing is worse off.
More cases can be worked in if the future if it becomes necessary.