This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
According to 11.8.4 [class.friend] paragraph 3,
A friend declaration that does not declare a function shall have one of the following forms:
friend elaborated-type-specifier ;
friend simple-type-specifier ;
friend typename-specifier ;
However, many implementations accept
friend enum E;
even though that form is explicitly not allowed by 9.2.9.5 [dcl.type.elab] paragraph 1 (which only permits class-key and not enum-key in friend declarations). Some implementations also accept opaque enumeration declarations like
friend enum E : int;
The latter form could plausibly be used in an example like:
class C {
constexpr static int priv = 15;
friend enum class my_constants;
};
enum class my_constants {
pub = C::priv; // OK because of friend decl
};
(See also issue 2131.)
Notes from the October, 2018 teleconference:
The suggested plausible use for the feature would require additional wording, because the effect of friendship is currently only described for classes and functions, not for enumerations. There does not appear to be a demand for the change.