-
Notifications
You must be signed in to change notification settings - Fork 772
Class types are not cv-qualified #4250
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
Comments
Uh, why? A cv-qualified class type is still a class type. For example, this works:
|
But this doesn't work (at least clang, GCC and VS reject the code), as there is no way for the compiler to parse the
So, I presume that your snippet compiles because the |
No, it compiles because of [class.derived] p2, and it would stop working with your change. |
In other words, "any cv-qualifiers are ignored" in [class.derived] p2 is what causes "doesn't carry the |
Could you tell me which grammar production would allow the compiler to parse the |
@jwakely I can see what you mean now. |
I meant Jens's snippet when I said "it compiles", because that's the one that compiles. Yours doesn't compile. In his example, the class-or-decltype What part of this is confusing you? |
As I said before I have already understood your point. But to avoid misunderstandings about this paragraph I would surely insert the Note below, as follows: A class-or-decltype shall denote a (possibly cv-qualified) class type that is not an incompletely defined
-end note] The class denoted by |
Since "struct D: const B" is syntactically invalid, this is the only remaining choice, with no need for further elaboration. The standard is not a tutorial. |
[class.derived]/2:
This should be replaced by:
A class-or-decltype shall denote a
(possibly cv-qualified)class type that is not an incompletely defined class ([class.mem]); any cv-qualifiers are ignored....
The text was updated successfully, but these errors were encountered: