diff --git a/binding_generator.py b/binding_generator.py index de428bc46..1a401a3b8 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -768,7 +768,10 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl result.append(f"class {class_name} {{") result.append(f"\tstatic constexpr size_t {snake_class_name}_SIZE = {size};") - result.append(f"\tuint8_t opaque[{snake_class_name}_SIZE] = {{}};") + # We don't get alignment information from the JSON so we have to guess. + # This logic should be correct for all built-in types as they exist right now. + alignment = 8 if size >= 8 else 4 + result.append(f"\talignas({alignment}) uint8_t opaque[{snake_class_name}_SIZE] = {{}};") result.append("") result.append("\tfriend class Variant;")