One can typedef function types, even with class cv- and ref-qualifiers:
typedef void F() const volatile &&;
This can be used to declare (but not define) non-static member functions:
struct A {
    F f;    // void f() const volatile &&
};
This use for F is explicitly forbidden in dependent contexts in templates.
It can also be used as template argument. As far as I can tell, there is however no way of extracting or manipulating the cv- and ref-qualifiers of the type.
Is there any other use case for such a typedef (with any qualifier, not necessarily all of them at once)?
The standard specifies the only allowed use cases of such function types (function types with a cv-qualifier-seq or a ref-qualifier) in [dcl.fct]/6:
A function type with a cv-qualifier-seq or a ref-qualifier (including a type named by typedef-name ([dcl.typedef], [temp.param])) shall appear only as:
(6.1) the function type for a non-static member function,
(6.2) the function type to which a pointer to member refers,
(6.3) the top-level function type of a function typedef declaration or alias-declaration,
(6.4) the type-id in the default argument of a type-parameter, or
(6.5) the type-id of a template-argument for a type-parameter ([temp.arg.type]).
Minimal reproducible representative example (mre):
using Func = void() const;
using Func2 = Func;       // (6.3)
struct C {
    Func f;               // (6.1)
};
Func C::* ptr;            // (6.2)
template <class T = Func> // (6.4)
struct S { };
S<Func> x;                // (6.5)
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With