Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msvc abi incompatibility: classes with a deleted copy ctor can be returned in registers #63360

Open
efriedma-quic opened this issue Jun 16, 2023 · 3 comments
Assignees

Comments

@efriedma-quic
Copy link
Collaborator

efriedma-quic commented Jun 16, 2023

struct Z { int z;  Z(const Z&) = delete;};
Z z(Z z) { return {z.z}; }

MSVC produces:

        mov     eax, DWORD PTR [rcx]
        ret     0

Clang targeting Windows produces:

        mov     rax, rcx
        mov     ecx, dword ptr [rdx]
        mov     dword ptr [rax], ecx
        ret
@llvmbot
Copy link
Collaborator

llvmbot commented Jun 16, 2023

@llvm/issue-subscribers-clang-codegen

@efriedma-quic
Copy link
Collaborator Author

efriedma-quic commented Jun 16, 2023

Interesting edge case on AArch64:

struct Z { double z;  Z(const Z&) = delete;};
Z z(Z z) { return {z.z}; }

Produces:

        ldr         x0,[x0]
        ret

So we return the value in registers, but only integer registers; it doesn't count as an HVA/HFA.

@efriedma-quic
Copy link
Collaborator Author

CC @rnk

@rnk rnk assigned rnk and amykhuang and unassigned rnk Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants