Skip to content

Commit

Permalink
Fix issue 21372: remove premature deprecation check.
Browse files Browse the repository at this point in the history
  • Loading branch information
FeepingCreature committed Nov 9, 2020
1 parent 90d30a7 commit d2730e5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/dmd/typesem.d
Expand Up @@ -3659,12 +3659,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 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 d2730e5

Please sign in to comment.