Skip to content

Commit

Permalink
Merge pull request #11940 from FeepingCreature/fix/21372-remove-prema…
Browse files Browse the repository at this point in the history
…ture-deprecation-check

Fix issue 21372: remove premature deprecation check.
  • Loading branch information
Geod24 committed Nov 16, 2020
2 parents 88645a6 + d3a058a commit a64d50d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/dmd/typesem.d
Expand Up @@ -3721,12 +3721,6 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, int flag)
{
return noMember(mt, sc, e, ident, flag);
}
if (!s.isFuncDeclaration()) // because of overloading
{
s.checkDeprecated(e.loc, sc);
if (auto d = s.isDeclaration())
d.checkDisabled(e.loc, sc);
}
s = s.toAlias();

if (auto em = s.isEnumMember())
Expand All @@ -3735,6 +3729,8 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, int flag)
}
if (auto v = s.isVarDeclaration())
{
v.checkDeprecated(e.loc, sc);
v.checkDisabled(e.loc, sc);
if (!v.type ||
!v.type.deco && v.inuse)
{
Expand Down
24 changes: 24 additions & 0 deletions test/compilable/test21372.d
@@ -0,0 +1,24 @@
// REQUIRED_ARGS: -de
struct S
{
deprecated void foo(T)(int) { }
void foo(T)(string) { }
}

// just to be safe, check this order too
// (there were some issues where naive checks of overloads were order dependent)
struct T
{
void foo(T)(string) { }
deprecated void foo(T)(int) { }
}

void main()
{
// this should not hit the deprecation
// because the parameter type doesn't match it
S().foo!int("hi");

// likewise
T().foo!int("hi");
}

0 comments on commit a64d50d

Please sign in to comment.