Fix the way we trigger an error on Kaleidoscope.use() with V2 API

When using `Kaleidoscope.use()` and the V1 API is disabled, we want to display
an error. The current method of doing that is not reliable, it sometimes works,
sometimes will error out even when not using `Kaleidoscope.use()`. To fix this,
delay the initialisation of `.use()`, so it only evaluates when used, and thus,
only fails with a descriptive error in that case.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/346/head
Gergely Nagy 6 years ago
parent 4c804d6766
commit 94fc92a95a

@ -142,8 +142,9 @@ class Kaleidoscope_ {
} }
#else #else
// NOTE: Do **NOT** remove this when sunsetting the V1 API! // NOTE: Do **NOT** remove this when sunsetting the V1 API!
inline void use(...) { template <typename Plugin__>
static_assert(false, _DEPRECATE(_DEPRECATED_MESSAGE_USE)); inline void use(Plugin__ first, ...) {
static_assert(sizeof(Plugin__) < 0, _DEPRECATE(_DEPRECATED_MESSAGE_USE));
} }
#endif #endif

Loading…
Cancel
Save