From bd09f8e853b7552ed66fda9761f0e8922ac941f3 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Fri, 20 Nov 2020 17:07:24 -0500 Subject: [PATCH] Remove UB with proper conditional --- include/sol/stack_core.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sol/stack_core.hpp b/include/sol/stack_core.hpp index 1baaf143..51a00302 100644 --- a/include/sol/stack_core.hpp +++ b/include/sol/stack_core.hpp @@ -104,7 +104,7 @@ namespace sol { std::size_t aligned_space_for(void* alignment = nullptr) { // use temporary storage to prevent strict UB shenanigans char alignment_shim[(std::max)({ sizeof(Args)... }) + (std::max)({ alignof(Args)... })] {}; - char* start = alignment == nullptr ? static_cast(alignment) : alignment_shim; + char* start = alignment != nullptr ? static_cast(alignment) : alignment_shim; (void)detail::swallow { int {}, (align_one(std::alignment_of_v, sizeof(Args), alignment), int {})... }; return static_cast(alignment) - start; }