Skip to content

ctfeexpr: support reinterpreting cast when switching safe/pure/nothrow in both directions #12514

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

Merged
merged 1 commit into from
Jun 7, 2021

Conversation

ljmf00
Copy link
Member

@ljmf00 ljmf00 commented May 11, 2021

Signed-off-by: Luís Ferreira contact@lsferreira.net

@UplinkCoder
Copy link
Member

allowing this cast breaks the type system

@UplinkCoder
Copy link
Member

Where's the bugreport which requests this?

@ljmf00
Copy link
Member Author

ljmf00 commented May 12, 2021

allowing this cast breaks the type system

Yes. Although, AFAIK CTFE engine can handle these cases. Some functions on standard library use assumePure that does this type of casts. I can do further testing to see if this is viable.

@ljmf00
Copy link
Member Author

ljmf00 commented May 12, 2021

Where's the bugreport which requests this?

There's no bug report for this, atm.

@ljmf00 ljmf00 marked this pull request as ready for review May 12, 2021 13:52
@ljmf00 ljmf00 requested a review from UplinkCoder as a code owner May 12, 2021 13:52
@MoonlightSentinel
Copy link
Contributor

There's no bug report for this, atm.

Please create a new one or add a changelog entry

... both directions

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
@MoonlightSentinel MoonlightSentinel force-pushed the fix-reinterpreting-cast-ctfe branch from caad5fa to 3f12de0 Compare June 6, 2021 16:58
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @ljmf00! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
21997 enhancement CTFE should allow function pointer casts with different attributes

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#12514"

@MoonlightSentinel
Copy link
Contributor

Added a bugzilla reference and slightly extended the test case

@thewilsonator thewilsonator merged commit 20b0788 into dlang:master Jun 7, 2021
@ljmf00
Copy link
Member Author

ljmf00 commented Jun 7, 2021

Added a bugzilla reference and slightly extended the test case

I'm so sorry for not answering quickly. As I mentioned previously here, dlang/dlang.org#2946 (comment), I'm very busy due to school stuff.

@MoonlightSentinel
Copy link
Contributor

No worries, I just wanted to have these changes to enable dlang/druntime#3494.

@tom-tan
Copy link
Contributor

tom-tan commented Aug 14, 2021

Can we extend the same idea to other interpreting casts?
For example, CTFEability of casting from immutable to mutable is one of blockers of issue 21405.

@ljmf00
Copy link
Member Author

ljmf00 commented Aug 14, 2021

Can we extend the same idea to other interpreting casts?
For example, CTFEability of casting from immutable to mutable is one of blockers of issue 21405.

I can look at this when I have some time.

@JohanEngelen
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants