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
[new syntax] Support function
ref
Type Parameters for function pointer types
#15243
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request and interest in making D better, @ntrel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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
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 + dmd#15243" |
function
ref
*Type Parameters* for function pointer typesfunction
ref
Type Parameters for function pointer types
Although this solves the That problem is not solved by this pull alone. Edit: Turns out we don't need |
Fixes Issue 2753 - Cannot declare pointer to function returning ref.
This token ordering is consistent with function literals:
https://dlang.org/spec/expression.html#function_literals
See https://forum.dlang.org/post/qngjoxgihmcsvoprnanb@forum.dlang.org for more on the grammar.
Alternatively, allowing Type
function
Parametersref
would also fix the issue, though that is less easy to see that the return value is actually a reference when looking at the return type. Also there is no precedent for that AIUI in the grammar, though the compiler does use this ordering in error messages despite it being invalid syntax.Another option would be Type
ref
function
Parameters, but again, no precedent for that.This pull implements support for 'leading function' pointer types in most places,
but not for a declaration at module scope yet.