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

Fix #20601 - hasIndirections does not handle static arrays of length 0 correctly #20602

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

jmdavis
Copy link
Member

@jmdavis jmdavis commented Dec 25, 2024

hasIndirections doesn't handle static arrays of length 0 correctly (they don't actually have any indirections), because operator precedence resulted in the check for 0 length static arrays having no actual effect.

I also copied the test for
https://issues.dlang.org/show_bug.cgi?id=12000 from std.traits to here, because it's really a compiler bug that's being tested rather than hasIndirections itself (so being in the compiler repo arguably makes more sense), and it also arguably makes more sense to put it next to the actual implementation than in std.traits where it's been.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @jmdavis!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

  • In preparation for migrating from Bugzilla to GitHub Issues, the issue reference syntax has changed. Please add the word "Bugzilla" to issue references. For example, Fix Bugzilla Issue 12345 or Fix Bugzilla 12345.(Reminder: the edit needs to be done in the Git commit message, not the GitHub pull request.)

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#20602"

@jmdavis jmdavis added the Druntime Specific to druntime label Dec 25, 2024
@thewilsonator thewilsonator changed the title Fix #20601. Fix #20601 - hasIndirections does not handle static arrays of length 0 correctly Dec 25, 2024
hasIndirections doesn't handle static arrays of length 0 correctly (they
don't actually have any indirections), because operator precedence
resulted in the check for 0 length static arrays having no actual
effect.

I also copied the test for
https://issues.dlang.org/show_bug.cgi?id=12000 from std.traits to here,
because it's really a compiler bug that's being tested rather than
hasIndirections itself (so being in the compiler repo arguably makes
more sense), and it also arguably makes more sense to put it next to the
actual implementation than in std.traits where it's been.
@jmdavis jmdavis merged commit cf64f24 into dlang:master Dec 25, 2024
41 checks passed
@jmdavis jmdavis deleted the issue_20601 branch December 25, 2024 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Druntime Specific to druntime Feature:traits Relating to __traits Merge:auto-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants