diff --git a/include/binlog/adapt_stdvariant.hpp b/include/binlog/adapt_stdvariant.hpp index 0987c99..8b11855 100644 --- a/include/binlog/adapt_stdvariant.hpp +++ b/include/binlog/adapt_stdvariant.hpp @@ -55,6 +55,13 @@ struct CustomSerializer> template struct CustomTag> { + // Make this type not-constructible, if some Tag is not constructible + std::conditional_t< + detail::conjunction...>::value, + std::true_type, + mserialize::detail::BuiltinTag + > tag_guard; + static constexpr auto tag_string() { return cx_strcat( diff --git a/test/integration/LoggingVariants.cpp b/test/integration/LoggingVariants.cpp index e25d99b..0cb8cde 100644 --- a/test/integration/LoggingVariants.cpp +++ b/test/integration/LoggingVariants.cpp @@ -91,3 +91,11 @@ int main() binlog::consume(std::cout); } + +struct Adapted {}; +BINLOG_ADAPT_STRUCT(Adapted) + +struct NotAdapted {}; + +static_assert(mserialize::detail::has_tag>::value, ""); +static_assert(!mserialize::detail::has_tag>::value, "");