-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
Object creation is erroneously explained with a copy construction #120
Comments
Hello @GPopov, thank you for reporting that finding. How would you like the default ctor to be visualized? Andreas |
This is an interesting and difficult question. If there was a obviously really more expressive way, most probably the C++ committee would have opted for it already. A very suboptimal soultion would be as a comment, detailing all the relevant c-tors and special member functions that get invoked.
transformed into
This solution has multiple problems with it, starting with the fact that if the line is rather more complicated, this comment would quickly just as difficult to understand as the original line. Maybe some plain-english explanation could be thought about, again as a comment, but this feels a bit against the goal of your project. As a starting point, I'd say that at the very least and a starting point, no incorrect explanation should be produced. |
Yes it is indeed difficult. I agree that nothing incorrect should be produced. On the other hand, without a proper alternative I feel reluctant to just remove it. I like to think more about it. |
Creating an object of some class is explained as if a copy construction is performed, which is not the case for standard-compliant compilers.
Example:
The line (1) is transformed into:
A a = A();
This is wrong, as it would invoke the deleted copy ctor of A. Proof: https://godbolt.org/z/wct9r5
The text was updated successfully, but these errors were encountered: