From 70b29267e7bcd73becb838cfe9adf5b92f608164 Mon Sep 17 00:00:00 2001 From: JinShil Date: Fri, 31 Aug 2018 21:35:36 +0900 Subject: [PATCH] Fix Issue 19202 - deprecated eponymous template prints no warning --- src/dmd/expressionsem.d | 2 ++ test/fail_compilation/test19202.d | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/fail_compilation/test19202.d 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; +}