Why a template with Nullable does not compile?
Nicholas Wilson
iamthewilsonator at hotmail.com
Tue Mar 12 09:05:36 UTC 2019
On Tuesday, 12 March 2019 at 05:14:21 UTC, Victor Porton wrote:
> Why does this not compile?
>
> import std.typecons;
>
> template FieldInfo(T, Nullable!T default_) {
> }
>
> /usr/lib/ldc/x86_64-linux-gnu/include/d/std/typecons.d(2570,17): Error: `alias T = T;` cannot alias itself, use a qualified name to create an overload set
> /usr/lib/ldc/x86_64-linux-gnu/include/d/std/typecons.d(3291,17): Error: `alias T = T;` cannot alias itself, use a qualified name to create an overload set
It seems to be getting confused between the two types of
Nullable, namely:
Nullable(T), and
Nullable(T, T defaultVal)
template FieldInfo(T) {
template FieldInfo(Nullable!(T) default_)
{
enum FieldInfo = 0;
}
}
seems to work, but I can't seem to instantiate one of it.
More information about the Digitalmars-d-learn
mailing list