service/service: Make FunctionInfo's constructor constexpr

Allows our service function arrays to be constexpr.
This commit is contained in:
Lioncash
2018-12-17 23:21:53 -05:00
parent 84823a3036
commit a9c3c042a7

View File

@@ -122,9 +122,6 @@ class ServiceFramework : public ServiceFrameworkBase {
protected:
/// Contains information about a request type which is handled by the service.
struct FunctionInfo : FunctionInfoBase {
// TODO(yuriks): This function could be constexpr, but clang is the only compiler that
// doesn't emit an ICE or a wrong diagnostic because of the static_cast.
/**
* Constructs a FunctionInfo for a function.
*
@@ -134,7 +131,8 @@ protected:
* the request
* @param name human-friendly name for the request. Used mostly for logging purposes.
*/
FunctionInfo(u32 expected_header, HandlerFnP<Self> handler_callback, const char* name)
constexpr FunctionInfo(u32 expected_header, HandlerFnP<Self> handler_callback,
const char* name)
: FunctionInfoBase{
expected_header,
// Type-erase member function pointer by casting it down to the base class.