From 1cd9e9f1eac341f4d2b8bd516ded29be96e3286f Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Fri, 25 May 2018 21:43:50 +0200 Subject: [PATCH] fix #640 - Warning for variable used in ctor but not in standard func --- src/dscanner/analysis/unmodified.d | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/dscanner/analysis/unmodified.d b/src/dscanner/analysis/unmodified.d index 579a057..f73c173 100644 --- a/src/dscanner/analysis/unmodified.d +++ b/src/dscanner/analysis/unmodified.d @@ -138,6 +138,7 @@ final class UnmodifiedFinder : BaseAnalyzer mixin PartsMightModify!AsmPrimaryExp; mixin PartsMightModify!IndexExpression; mixin PartsMightModify!FunctionCallExpression; + mixin PartsMightModify!NewExpression; mixin PartsMightModify!IdentifierOrTemplateChain; mixin PartsMightModify!ReturnStatement; @@ -368,4 +369,15 @@ bool isValueTypeSimple(const Type type) pure nothrow @nogc void foo(){auto e = new E;} }, sac); + assertAnalyzerWarnings(q{ + void issue640() + { + size_t i1; + new Foo(i1); + + size_t i2; + foo(i2); + } + }, sac); } +