Work around ReplaceType compile error issue.

ReplaceType doesn't work for "class C : D!C {}"
This commit is contained in:
Sönke Ludwig 2019-02-23 15:56:59 +01:00
parent b766f62d43
commit a52958ef01

View file

@ -603,7 +603,12 @@ template TypeOf(alias kind)
else alias FT = uda[0];
}
alias TypeOf = ReplaceType!(This, U, FT);
// NOTE: ReplaceType has issues with certain types, such as a class
// declaration like this: class C : D!C {}
// For this reason, we test first if it compiles and only then use it.
static if (is(ReplaceType!(This, U, FT)))
alias TypeOf = ReplaceType!(This, U, FT);
else alias TypeOf = FT;
}
///