diff --git a/src/dmd/expressionsem.d b/src/dmd/expressionsem.d index 315cf0612973..dc1d5e884177 100644 --- a/src/dmd/expressionsem.d +++ b/src/dmd/expressionsem.d @@ -2888,6 +2888,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor if (auto v = s.isVarDeclaration()) { + s.checkDeprecated(exp.loc, sc); + if (!v.type) { exp.error("forward reference of %s `%s`", v.kind(), v.toChars()); diff --git a/test/fail_compilation/test19202.d b/test/fail_compilation/test19202.d new file mode 100644 index 000000000000..ddaa6bb36d07 --- /dev/null +++ b/test/fail_compilation/test19202.d @@ -0,0 +1,19 @@ +/* +REQUIRED_ARGS: -de +TEST_OUTPUT +--- +fail_compilation/test19202.d(13): Deprecation: variable `test19202.X!().X` is deprecated +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=19202 + +void main() +{ + auto b = X!(); +} + +template X() +{ + deprecated enum X = true; +}