From b5939da59557f4a2e6e78fb42a5771afd0b1d774 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Sat, 9 Feb 2019 23:39:52 +0100 Subject: [PATCH] Refuse to compile if alignment of user data cannot be satisfied --- src/App.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/App.h b/src/App.h index afd82b4..dd7b40c 100644 --- a/src/App.h +++ b/src/App.h @@ -96,6 +96,10 @@ public: template TemplatedApp &&ws(std::string pattern, WebSocketBehavior &&behavior) { + /* Don't compile if alignment rules cannot be satisfied */ + static_assert(alignof(UserData) <= LIBUS_EXT_ALIGNMENT, + "µWebSockets cannot satisfy UserData alignment requirements. You need to recompile µSockets with LIBUS_EXT_ALIGNMENT adjusted accordingly."); + /* Every route has its own websocket context with its own behavior and user data type */ auto *webSocketContext = WebSocketContext::create(Loop::defaultLoop(), (us_new_socket_context_t *) httpContext);