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
Attributes on hidden friends #6054
Comments
We show (otherwise ill-formed) repeated default arguments in the various synopses, for example. |
Ok, so nothing to do, and one should "read between the lines" to interpret the synopsys code correctly? |
Yes, it tells you the API, it's not meant to be a conforming implementation. |
In particular, [intro.compliance.general] p4 says
So, this explicitly says the implementation must plug in a definition. Nothing to see here, I guess. |
From this thread on the std-proposals ML: https://lists.isocpp.org/std-proposals/2023/01/5452.php
https://eel.is/c++draft/stoptoken.general declares the friend function
This declaration is to be taken as a hidden friend as per https://eel.is/c++draft/hidden.friends . As such, an implementation will have no choice but to immediately define that function rather than just declare it.
However it's "mildly interesting" that the declaration above in the class synposis is actually ill-formed, per https://eel.is/c++draft/dcl.attr#grammar-5.sentence-3 :
AFAICS, [stoptoken.general] is the only place in the Standard Library where an attribute is used on a friend declaration.
I'm not sure if it should be fixed editorially somehow, for instance by adding another note to [hidden.friends] that says that such declarations may have attributes which are meant to be interpreted as attributes appearing on the definition, or something along those lines. Are there any other places where the Standard Library shows actual code (no "exposition only" / "see below" / etc.) that actually is ill-formed?
The text was updated successfully, but these errors were encountered: