[Issue 14675] template specialization for T: T* and T: T[] has issues with IFTI
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jun 10 18:54:56 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14675
--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
Personally I call the things `T : T*` "self-dependent" or "self-specialized"
template parameter.
I agree that is one of a strange feature in D. I guess it would be a syntax to
declare a type parameter with specialization at once.
// C++
template <typename T> class C;
template <typename T> class C<T*> { ... }
// Equivalent D code
class C(T : T*) { ... }
It takes one place in template parameter list. When a template argument is
_explicitly given_ on the position, it will deduce the parameter T, by matching
the argument to the form `T*`.
That's the point. Even if you explicitly give template argument, T is always
deduced.
On the other hand, IFTI deduces T from the function argument types before
testing the specialization. After the T determined, specialization test always
fail because T won't match to T*.
Therefore, we cannot make possible using it along with IFTI.
--
More information about the Digitalmars-d-bugs
mailing list