Created on 2017-10-26.00:00:00, last changed 2017-10-26.00:00:00.
According to 14.3 [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 10.1.7.3 [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.)
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-10-26 00:00:00 | admin | create |