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

Deleted function can return incomplete type #52802

Closed
Fedr opened this issue Dec 19, 2021 · 2 comments
Closed

Deleted function can return incomplete type #52802

Fedr opened this issue Dec 19, 2021 · 2 comments
Assignees
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@Fedr
Copy link

Fedr commented Dec 19, 2021

The following program is valid:

struct A;
A f() = delete;

It is accepted by GCC, but rejected by Clang with the error:

error: incomplete result type 'A' in function definition

which is wrong per https://timsong-cpp.github.io/cppwp/n4868/dcl.fct.def#general-2.sentence-3

Demo: https://gcc.godbolt.org/z/937PEz1h3

Related discussion: https://stackoverflow.com/q/70410542/7325599

@poyaoc97 poyaoc97 self-assigned this Apr 3, 2022
@poyaoc97
Copy link
Member

poyaoc97 commented Apr 3, 2022

My patch to this issue

@poyaoc97 poyaoc97 added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Apr 3, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 3, 2022

@llvm/issue-subscribers-clang-frontend

jyknight added a commit that referenced this issue May 22, 2022
Follow-up to previous commit: Add a DR test-case so the
make_cxx_dr_status automation works.

Bug: #52802
Fixes: 50b1faf
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
According to CWG 1394 and C++20 [dcl.fct.def.general]p2,
Clang should not diagnose incomplete types if function body is "= delete;".
For example:
```
struct Incomplete;
Incomplete f(Incomplete) = delete; // well-formed
```

Also close llvm/llvm-project#52802

Differential Revision: https://reviews.llvm.org/D122981
neobrain added a commit to neobrain/FEX that referenced this issue Dec 12, 2023
Returning incomplete types from deleted functions is valid C++, but clang
did not support it until version 15:
llvm/llvm-project#52802
neobrain added a commit to neobrain/FEX that referenced this issue Dec 13, 2023
Returning incomplete types from deleted functions is valid C++, but clang
did not support it until version 15:
llvm/llvm-project#52802
neobrain added a commit to neobrain/FEX that referenced this issue Dec 21, 2023
Returning incomplete types from deleted functions is valid C++, but clang
did not support it until version 15:
llvm/llvm-project#52802
neobrain added a commit to neobrain/FEX that referenced this issue Dec 21, 2023
Returning incomplete types from deleted functions is valid C++, but clang
did not support it until version 15:
llvm/llvm-project#52802
neobrain added a commit to neobrain/FEX that referenced this issue Dec 22, 2023
Returning incomplete types from deleted functions is valid C++, but clang
did not support it until version 15:
llvm/llvm-project#52802
neobrain added a commit to neobrain/FEX that referenced this issue Dec 26, 2023
Returning incomplete types from deleted functions is valid C++, but clang
did not support it until version 15:
llvm/llvm-project#52802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

4 participants