D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9654 - Template function cannot take string by ref T[len]
Summary: Template function cannot take string by ref T[len]
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2013-03-05 20:46 UTC by Kenji Hara
Modified: 2013-03-15 09:58 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2013-03-05 20:46:45 UTC
This code should work.

void foo(ref const char[8] str) {}
void bar(T)(ref const T[8] str) {}

void main()
{
    foo("testinfo");  // OK
    bar("testinfo");  // should be OK, but fails
}
Comment 2 github-bugzilla 2013-03-05 22:43:49 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a9c17e46e968e45c2ed329b658e714659362cae5
fix Issue 9654 - Template function cannot take string by ref T[len]

https://github.com/D-Programming-Language/dmd/commit/fb5f3fb7c9f8cf60c6495bd9df4103e80553e588
Merge pull request #1723 from 9rnsr/fix9654

Issue 9654 - Template function cannot take string by ref T[len]
Comment 3 github-bugzilla 2013-03-15 09:58:40 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c0c678e73a088482da91b6e05c1ec91788461273
fix Issue 9654 - Template function cannot take string by ref T[len]

That should work even if len is TemplateValueParameter.