template Foo(X) { alias int Foo; } int m; alias Foo!(m) XXX; bug.d(7): Error: template instance Foo!(m) does not match template declaration Foo(X) It should say something like, "m is not a type".
When no constraint is present indeed this could be an additional error message. There's an helper for that in the compiler. When there's a constraint this possibly new message should not be added since there's work to format them prettier.
@wolframw created dlang/dmd pull request #12289 "Issue 7352 - Poor error message when using variable as template type parameter" mentioning this issue: - Issue 7352 - Poor error message when using variable as template type parameter https://github.com/dlang/dmd/pull/12289
dlang/dmd pull request #12289 "Fix Issue 7352 - Poor error message when using variable as template type parameter" was merged into master: - 07a0fa610f90777ae52fd90332527e053586c1ce by wolframw: Issue 7352 - Poor error message when using variable as template type parameter https://github.com/dlang/dmd/pull/12289