-
-
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
[WIP RFC]making __ctfe usable in static if #6098
Conversation
|
Oops I just spotted a big mistake,,, |
c8aaa70
to
52d941e
Compare
|
@UplinkCoder could you please add a test case to prevent regression and ensure it works on all platforms? |
52d941e
to
7e8afaa
Compare
|
Isn't this a language change that requires a change to the documentation as well? I don't believe that __ctfe currently works correctly in static contexts. |
|
Before I write docs I'd like to know if the community and leadership are okay with this change. |
3690aec
to
8de8eb7
Compare
|
@wilzbach took care of the tests. |
|
IIRC, @donc thinks |
|
@schveiguy |
|
passing the tests depends on dlang/druntime#1638 |
|
This change is fundamentally incorrect. CTFE does not create a separate version of runtime functions, it just happens to execute them at compile time. For However, this is not the case. There is only one copy of the function, and what your change does is merely to expose what triggered full semantic analysis for the function body to be run. This is of course just leaking an implementation detail, and not at all what |
|
@klickverbot makes sense |
|
@klickverbot |
Yep – while LDC can use aggressive link-time dead code elimination (LTO/--gc-sections), a pragma/… like that would make sense to clarify intent and save on compile times. See also: ldc-developers/ldc#1554 |
Hi this change allows __ctfe to be used in static ifs and static asserts.
Giving the developer a way to ensure (at compile time) that certain code-paths are never or only used at ctfe.
This effectively undos #4084