Skip to content

CWG2917 [temp.friend] Some variadic template friend declarations should be explicitly ill-formed. #593

Description

@cor3ntin

Consider

struct S {

template <typename T>
friend class Foo<T>::Nested; // #1

template <typename ...Ts>
friend class Foo<Ts>::Nested...; //#2

};

Here #1 declares a template friend declaration such that Foo<T>::Nested is a friend of S for any T, per
https://eel.is/c++draft/temp.friend#4 and https://eel.is/c++draft/temp.friend#5

However #2 doesn't really mean anything sensible. Yet there does not seem to be any wording specifying exactly what
variadic friend declarations are or are not allowed.

P2893 incorrectly claimed that #1 was ill-formed and consequently did not add wording to make #2 ill-formed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions