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
Comment #1 by b2.temp — 2016-09-11T13:27:46Z
1. I don't see the first function working. (https://dpaste.dzfl.pl/2b462faf70b0). WHen you try to instantiate both gives the same error.
2. If you don't do partial instantiation then your alias can be declared more simply as 'alias TestAlias = TestType;'
3. The real problem you encounter here is that TestType template argument cannot be deduced from the value passed to the constructor:
struct TestType(T)
{
T data;
}
void main()
{
auto a = TestType(0); // same error
}
This is exactly what happens when you call TestFunctionA.
For example you can replace the declaration by:
void testFunctionB(T)(T arg) {}
and if you call
testFunction(TestType(0));
you get exactly the same error.
Comment #2 by b2.temp — 2016-09-11T13:31:03Z
This is not a bug, this is issue 6082. IFTI doesn't support this yet.
*** This issue has been marked as a duplicate of issue 6082 ***
Comment #3 by sky.13th.95 — 2016-09-11T14:00:46Z
(In reply to b2.temp from comment #2)
> This is not a bug, this is issue 6082. IFTI doesn't support this yet.
>
> *** This issue has been marked as a duplicate of issue 6082 ***
Sorry, but not we have some misunderstanding.
Question is not about a constructors. It about a types.
Here is more clear example: https://dpaste.dzfl.pl/2c8e1c350182
Comment #4 by sky.13th.95 — 2016-09-11T14:06:52Z
(In addition to Sky Thirteenth from comment #3)
> (In reply to b2.temp from comment #2)
> > This is not a bug, this is issue 6082. IFTI doesn't support this yet.
> >
> > *** This issue has been marked as a duplicate of issue 6082 ***
>
> Sorry, but not we have some misunderstanding.
>
> Question is not about a constructors. It about a types.
>
> Here is more clear example: https://dpaste.dzfl.pl/2c8e1c350182
Template aliases does not work correct while it used with template functions.
Compiler just somehow can't understand that is the same type, rather than different.
Comment #5 by b2.temp — 2016-09-11T15:10:50Z
I confirm the misunderstanding. If you permit I would suggest you to close this one but to open a new issue using your second example. The first one really represented issue 6082. The second is perfectly clear.
Comment #6 by sky.13th.95 — 2016-09-11T15:14:57Z
(In reply to b2.temp from comment #5)
> I confirm the misunderstanding. If you permit I would suggest you to close
> this one but to open a new issue using your second example. The first one
> really represented issue 6082. The second is perfectly clear.
Yes, sure.
But, you will create new one, or should I?
Comment #7 by b2.temp — 2016-09-11T15:35:22Z
(In reply to Sky Thirteenth from comment #6)
> (In reply to b2.temp from comment #5)
> > I confirm the misunderstanding. If you permit I would suggest you to close
> > this one but to open a new issue using your second example. The first one
> > really represented issue 6082. The second is perfectly clear.
>
> Yes, sure.
> But, you will create new one, or should I?
I wont, you will.
Comment #8 by sky.13th.95 — 2016-09-11T16:13:21Z
(In reply to b2.temp from comment #7)
> (In reply to Sky Thirteenth from comment #6)
> > (In reply to b2.temp from comment #5)
> > > I confirm the misunderstanding. If you permit I would suggest you to close
> > > this one but to open a new issue using your second example. The first one
> > > really represented issue 6082. The second is perfectly clear.
> >
> > Yes, sure.
> > But, you will create new one, or should I?
>
> I wont, you will.
OK, thank you.
Here the new one https://issues.dlang.org/show_bug.cgi?id=16486
Comment #9 by ag0aep6g — 2018-04-17T16:02:42Z
(In reply to Sky Thirteenth from comment #8)
> (In reply to b2.temp from comment #7)
> > (In reply to Sky Thirteenth from comment #6)
> > > (In reply to b2.temp from comment #5)
> > > > I confirm the misunderstanding. If you permit I would suggest you to close
> > > > this one but to open a new issue using your second example. The first one
> > > > really represented issue 6082. The second is perfectly clear.
[...]
> Here the new one https://issues.dlang.org/show_bug.cgi?id=16486
Since the issue has been moved, I'm closing this one as invalid.