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

Add a limitation respect to the generated =deleted special operations #233

Closed
viboes opened this issue Sep 28, 2019 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@viboes
Copy link

viboes commented Sep 28, 2019

As for Display the special operations generated by the compiler #224 discussion, we have identified the tool do not transforms the special operations functions that are deleted by the compiler. This is surely due to the fact that the tool is based on the AST and this information is not still there.

When the user request the default and the compiler deletes the function as he default generated will be ill formed, the tool could replace =default by =delete.

Before

struct C
{
int & i;
C() = default;
C(const C &) = default;
};

https://cppinsights.io/s/cd13011a

After

struct C
{
int & i;
inline C() = delete;
inline C(const C &) = delete;
};

I believe that the documentation could report this limitation on a specific section

@andreasfertig
Copy link
Owner

Hello @viboes,

that is a nice finding, thank you. I will push a fix for it.

Andreas

andreasfertig added a commit that referenced this issue Sep 30, 2019
Fixed #233: Show when the compiler deletes a special member.
@viboes viboes changed the title Add a limitation respect to the enerated =deleted special operations Add a limitation respect to the generated =deleted special operations Oct 1, 2019
@viboes
Copy link
Author

viboes commented Oct 1, 2019

Thanks a lot. This is super useful for people that are learning.

BTW, there was an error on my description.
The copy constructor is ok, but the copy assignment ends by being deleted.

@andreasfertig
Copy link
Owner

You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants