D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10231 - Spec: Document typed alias parameter feature
Summary: Spec: Document typed alias parameter feature
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: Andrej Mitrovic
URL:
Keywords: pull, spec
Depends on:
Blocks:
 
Reported: 2013-06-01 13:54 UTC by Andrej Mitrovic
Modified: 2014-04-23 00:12 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 Andrej Mitrovic 2013-06-01 13:54:22 UTC
Recently Kenji mentioned that the following works:

-----
struct X(alias int x)
{
}

void main()
{
    int i;
    alias X!i IVal;  // ok

    float f;
    alias X!f FVal;  // fail
}
-----

Even if this is allowed by the current syntax rules, it is largely an undocumented feature (compiler implementers could easily miss this feature as well). It should be properly documented.
Comment 1 Maxim Fomin 2013-06-01 14:35:49 UTC
By the way, it seems it does not support implicit type conversions.
Comment 2 Andrej Mitrovic 2013-06-01 14:37:18 UTC
(In reply to comment #1)
> By the way, it seems it does not support implicit type conversions.

For that I think I'd like this enhancement to work:

-----
struct X(alias T x, T : int)
{
}

void main()
{
    short i;
    alias X!i IVal;
}
-----
Comment 4 github-bugzilla 2014-04-23 00:12:54 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dlang.org

https://github.com/D-Programming-Language/dlang.org/commit/1b65c456b7a5c06aaad2945cb14edcc99f29d41a
Fix Issue 10231 - Document typed alias parameters.

https://github.com/D-Programming-Language/dlang.org/commit/2777f8da42e2f164aa1429d7734e85efc4c03be0
Merge pull request #555 from AndrejMitrovic/Fix10231

Issue 10231 - Document typed alias parameters.