digitalmars.D.bugs - [Issue 16465] New: Template alias does not get unwrapped in
- via Digitalmars-d-bugs (59/59) Sep 04 2016 https://issues.dlang.org/show_bug.cgi?id=16465
https://issues.dlang.org/show_bug.cgi?id=16465 Issue ID: 16465 Summary: Template alias does not get unwrapped in templated functions Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: sky.13th.95 gmail.com OK, here the situation: For example, We have this template: ``` struct TestType( T ) { T data; } ``` Then We added an alias on it: `alias TestAlias( T ) = TestType!T;` And from here strange things begins. If We will use original name (TestType), it will feel OK: ``` void testFunctionA( T )( TestType!T arg ) { writeln( arg ); } ``` But if We will use an alias, in a function declaration, it will cause compile time error: ``` void testFunctionA( T )( TestAlias!T arg ) { writeln( arg ); } ``` ``` Error: template test.testFunctionB cannot deduce function from argument types !()(TestType!int), candidates are: test.testFunctionB(T)(TestAlias!T arg) ``` As far as I understand this situation(I don't know how it really is), compiler see this alias declaration something like this: ``` template TestAlias( T ) { alias TestAlias = TestType!T; } ``` So on this stage it might understand it like a separate type(?), rather then alias on existing one. Compiler v2.071.0 --
Sep 04 2016