Skip to content

CWG3193 [dcl.friend] Missing rule banning friend declarations outside classes #906

Description

@timsong-cpp

Full name of submitter (unless configured in github; will be published with the issue):

Reference (section label): [dcl.friend]

Link to reflector thread (if any): see CWG mattermost

Issue description:

We seem to be missing a rule that actually disallows friend declarations outside classes. At least, I haven't been able to locate one after a quick look at all the use of friend in [dcl] and [class].

Suggested resolution:

Activity

  1. t3nsor commented on May 14, 2026

    @t3nsor

    Some other issues with friendship that should perhaps be folded into this issue:

    • There appears to be no normative text that specifies which class grants friendship (i.e. the class whose scope is inhabited by the friend declaration).
    • We say that a friend-type-declaration declares the designated type as a friend, but we don't specify the effect of the friend specifier on a function declaration.
  2. changed the title [-][dcl.friend] Missing rule banning friend declarations outside classes[/-] [+]CWG3193 [dcl.friend] Missing rule banning friend declarations outside classes[/+] on May 16, 2026
  3. jensmaurer commented on May 16, 2026

    @jensmaurer
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions