You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A member-declaration does not declare new members of the class if it is
(3.1) a friend declaration ([class.friend]), [...]
(3.3) a template-declaration whose declaration is one of the above,
which tells us that a template-declaration whose declaration is a friend-type-declaration is valid, but that doesn’t exclude the case I listed above. [temp.pre] disallows this for declarators (p5):
In a template-declaration, explicit specialization, or explicit instantiation, the init-declarator-list in the declaration shall contain at most one declarator.
But the case above, while a template-declaration, doesn’t even have declarators. It seems this case needs to be disallowed separately, but I can’t seem to find any section that would do that.
Suggested resolution:
In [temp.pre], add this to p5 (or as a separate paragraph after that; I’m not sure which would be better):
In a template-declaration whose declaration is a friend-type-declaration, the friend-type-specifier-list shall contain exactly one friend-type-specifier.
The text was updated successfully, but these errors were encountered:
jensmaurer
changed the title
[temp.pre] Disallow multiple friend-type-specifiers if the friend-declaration is part of a template-declaration
CWG2917 [temp.pre] Disallow multiple friend-type-specifiers if the friend-declaration is part of a template-declaration
Jul 30, 2024
Full name of submitter (unless configured in github; will be published with the issue): Ambrose T
Reference (section label): [temp.pre]
Issue description:
I ran into the following case while implementing variadic friends in Clang. Consider
This is obviously nonsense, but the grammar currently seems to allow it. A friend-type-declaration ([class.mem.general]) is defined as
In p3 of that same section, we find
which tells us that a template-declaration whose declaration is a friend-type-declaration is valid, but that doesn’t exclude the case I listed above. [temp.pre] disallows this for declarators (p5):
But the case above, while a template-declaration, doesn’t even have declarators. It seems this case needs to be disallowed separately, but I can’t seem to find any section that would do that.
Suggested resolution:
In [temp.pre], add this to p5 (or as a separate paragraph after that; I’m not sure which would be better):
The text was updated successfully, but these errors were encountered: