[Issue 16486] New: Compiler see template alias like a separate type in template function definition
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Sep 11 09:12:35 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16486
Issue ID: 16486
Summary: Compiler see template alias like a separate type in
template function definition
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: sky.13th.95 at gmail.com
For example, here the type:
```
struct TestType(T, size_t size)
{
T[size] data;
}
```
And, for some reason, We want to have some aliases on it:
```
alias TestAliasA = TestType;
alias TestAliasB(T) = TestType!(T, 3);
```
Then We, obviously, somehow use them:
```
void testFunctionA(T)(TestType!(T, 3) arg)
{
writeln( arg );
}
void testFunctionB(T)(TestAliasA!(T, 3) arg)
{
writeln( arg );
}
void testFunctionC(T)(TestAliasB!T arg)
{
writeln( arg );
}
```
But there is the problem with usage of `testFunctionC`.
It cause compiler error. It just simply can not recognize
that TestAliasB!T and TestType!(int, 3) is the same type,
rather than different.
Here complete example: https://dpaste.dzfl.pl/2c8e1c350182
--
More information about the Digitalmars-d-bugs
mailing list