Skip to content

Fix default argument attributes#10991

Merged
thewilsonator merged 1 commit intodlang:masterfrom
dkorpel:defaultarg-fixes
Apr 9, 2026
Merged

Fix default argument attributes#10991
thewilsonator merged 1 commit intodlang:masterfrom
dkorpel:defaultarg-fixes

Conversation

@dkorpel
Copy link
Copy Markdown
Contributor

@dkorpel dkorpel commented Apr 9, 2026

Blocking dlang/dmd#22903

The value of getDefaultTZDatabaseDir() is used as a default argument in @safe functions, which was previously allowed, but with the bug fix applied gives the correct error:

  std/datetime/timezone.d(2083): Error: `@safe` function `std.datetime.systime.SysTime.__unittest_L6751_C11` cannot call `@system` function `std.datetime.timezone.PosixTimeZone.getDefaultTZDatabaseDir`
      static immutable(PosixTimeZone) getTimeZone(string name, string tzDatabaseDir = getDefaultTZDatabaseDir()) @trusted
                                                                                                             ^
  std/datetime/timezone.d(2044):        `std.datetime.timezone.PosixTimeZone.getDefaultTZDatabaseDir` is declared here
      private static string getDefaultTZDatabaseDir()
                            ^

@dlang-bot
Copy link
Copy Markdown
Contributor

Thanks for your pull request and interest in making D better, @dkorpel! 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

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.

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 + phobos#10991"

@thewilsonator thewilsonator merged commit e5bc6af into dlang:master Apr 9, 2026
10 checks passed
@dkorpel dkorpel deleted the defaultarg-fixes branch April 9, 2026 22:53
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.

3 participants