fix Issue 15298 - Can't call nested template function unless it's anonymous
Treat nested template functions the same as template function literals when passing them by alias.
Thanks for your pull request, @ibuclaw!
Bugzilla references
| Auto-close | Bugzilla | Severity | Description |
|---|---|---|---|
| ✓ | 15298 | normal | Can't call nested template function unless it's anonymous |
| ✓ | 21287 | normal | Delegate in global template can't call non-anonymous nested function passed as alias |
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#13006"
I'm really not convinced that this should be considered valid code, because now templates with two alias parameters no longer compile due to lack of dual context support - see failing testsuite of real world projects.
The spec says:
If a template has a template alias parameter, and is instantiated with a local symbol, the instantiated function will implicitly become nested in order to access runtime data of the given local symbol.
So, if these examples should not be considered valid, then the spec needs to be updated to explain which local symbols cause implicit nesting and which don't.