www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16486] New: Compiler see template alias like a separate type

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 puremagic.com
          Reporter: sky.13th.95 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

--
Sep 11 2016