Make toDelegate safe for function pointers#10599
Merged
thewilsonator merged 1 commit intodlang:masterfrom Dec 30, 2024
Merged
Conversation
Contributor
|
Thanks for your pull request, @0xEAB! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. 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 + phobos#10599" |
c569c33 to
89d37f4
Compare
LightBender
approved these changes
Dec 29, 2024
rikkimax
requested changes
Dec 29, 2024
89d37f4 to
65c7071
Compare
65c7071 to
5ebfe85
Compare
rikkimax
approved these changes
Dec 30, 2024
Co-authored-by: Elias Batek <0xEAB@users.noreply.github.com>
5ebfe85 to
ac35640
Compare
Bolpat
reviewed
Jan 22, 2025
Comment on lines
+1894
to
+1895
| static assert(!is(typeof(&s1.opCall) == delegate)); | ||
| S1 s1; |
Contributor
There was a problem hiding this comment.
What’s that doing?
In static assert(!is(typeof(&s1.opCall) == delegate));, the local variable s1 isn’t in scope.
If you swap the lines, the static assert passes.
Member
Author
There was a problem hiding this comment.
Apparently, it’s a copy&paste of this code:
Lines 1891 to 1901 in 8c6fca9
https://github.com/dlang/phobos/blame/8c6fca9ccdb30b69b627808c698526a76f7c4248/std/functional.d#L1891-L1901
0xEAB
added a commit
to 0xEAB/phobos
that referenced
this pull request
Jan 24, 2025
As discovered by @Bolpat: <dlang#10599 (comment)>
0xEAB
added a commit
to 0xEAB/phobos
that referenced
this pull request
Jan 24, 2025
As discovered by @Bolpat: <dlang#10599 (comment)>
0xEAB
added a commit
to 0xEAB/phobos
that referenced
this pull request
Jan 24, 2025
As discovered by @Bolpat: <dlang#10599 (comment)>
thewilsonator
pushed a commit
that referenced
this pull request
Jan 24, 2025
As discovered by @Bolpat: <#10599 (comment)>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Revamp of #8769.
While I’m not sure whether it covers all use-cases that @Bolpat’s patch had considered and that exist (also see Dennis’ unanswered question over there), it at least passes the testsuite on my machine.
As this is a
@trustedhack, I’d appreciate my patch to be thoroughly reviewed.