[Issue 16465] Template alias does not get unwrapped in templated functions
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Sep 11 06:27:46 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16465
b2.temp at gmx.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Hardware|x86_64 |All
OS|Windows |All
--- Comment #1 from b2.temp at gmx.com ---
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.
--
More information about the Digitalmars-d-bugs
mailing list