Skip to content

Commit

Permalink
Fix Issue 19419 - [REG2.080.1] @disabled this() will print wrong erro…
Browse files Browse the repository at this point in the history
…r if calling non-default constructor with wrong parameters
  • Loading branch information
RazvanN7 committed Nov 22, 2018
1 parent 55094b1 commit 837bbc2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dmd/func.d
Expand Up @@ -2749,7 +2749,8 @@ extern (C++) FuncDeclaration resolveFuncCall(const ref Loc loc, Scope* sc, Dsymb
{
assert(fd);

if (fd.checkDisabled(loc, sc))
// remove when deprecation period of class allocators and deallocators is over
if (fd.isNewDeclaration() && fd.checkDisabled(loc, sc))
return null;

bool hasOverloads = fd.overnext !is null;
Expand Down
21 changes: 21 additions & 0 deletions test/fail_compilation/fail19419.d
@@ -0,0 +1,21 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail19419.d(20): Error: none of the overloads of `this` are callable using argument types `(int)`, candidates are:
fail_compilation/fail19419.d(12): `fail19419.B.this()`
fail_compilation/fail19419.d(14): `fail19419.B.this(string s)`
---
*/

struct B
{
@disable this();

this(string s)
{}
}

void main()
{
auto b = B(3);
}

0 comments on commit 837bbc2

Please sign in to comment.