Skip to content

fix #21476: Presence of move constructor causes overload error - #21477

Merged
thewilsonator merged 1 commit into
dlang:stablefrom
ibuclaw:issue21476
Jun 27, 2025
Merged

thewilsonator merged 1 commit into
dlang:stablefrom
ibuclaw:issue21476

Conversation

@ibuclaw

@ibuclaw ibuclaw commented Jun 24, 2025 •

Copy link
Copy Markdown
Member

Move constructors were incorrectly being considered as regular constructors, which resulted in the test case failing with:

compilable/test21476.d(12): Error: none of the overloads of `this` are callable using argument types `(string)`
    auto o = S21476("aoe");
                   ^
compilable/test21476.d(6):        Candidates are: `test21476.S21476.this(ref return scope S21476)`
    this(ref return scope S21476);
    ^
compilable/test21476.d(7):                        `test21476.S21476.this(return scope S21476)`
    this(return scope S21476);
    ^

With this change, a struct literal is now used to construct the object.

Closes: #21476

@dlang-bot

Copy link
Copy Markdown

Thanks for your pull request, @ibuclaw!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

  • In preparation for migrating from Bugzilla to GitHub Issues, the issue reference syntax has changed. Please add the word "Bugzilla" to issue references. For example, Fix Bugzilla Issue 12345 or Fix Bugzilla 12345.(Reminder: the edit needs to be done in the Git commit message, not the GitHub pull request.)

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "stable + dmd#21477"

Comment thread compiler/src/dmd/func.d Resolved
Move constructors were incorrectly being considered as regular
constructors, which resulted in the test case failing with:
```
compilable/test21476.d(12): Error: none of the overloads of `this` are callable using argument types `(string)`
    auto o = S21476("aoe");
                   ^
compilable/test21476.d(6):        Candidates are: `test21476.S21476.this(ref return scope S21476)`
    this(ref return scope S21476);
    ^
compilable/test21476.d(7):                        `test21476.S21476.this(return scope S21476)`
    this(return scope S21476);
    ^
```
With this change, a struct literal is now used to construct the object.
@thewilsonator
thewilsonator merged commit 17184b4 into dlang:stable Jun 27, 2025
@ibuclaw
ibuclaw deleted the issue21476 branch July 16, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants