aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index c3e24ecb46..37c93c638a 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -2788,6 +2788,9 @@ static Error resolve_struct_zero_bits(CodeGen *g, ZigType *struct_type) {
type_struct_field->src_index = i;
type_struct_field->gen_index = SIZE_MAX;
+ if (type_struct_field->is_comptime)
+ continue;
+
switch (type_val_resolve_requires_comptime(g, field_type_val)) {
case ReqCompTimeYes:
struct_type->data.structure.requires_comptime = true;
@@ -7987,8 +7990,9 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS
// inserting padding bytes where LLVM would do it automatically.
size_t llvm_struct_abi_align = 0;
for (size_t i = 0; i < field_count; i += 1) {
- ZigType *field_type = struct_type->data.structure.fields[i]->type_entry;
- if (!type_has_bits(field_type))
+ TypeStructField *field = struct_type->data.structure.fields[i];
+ ZigType *field_type = field->type_entry;
+ if (field->is_comptime || !type_has_bits(field_type))
continue;
LLVMTypeRef field_llvm_type = get_llvm_type(g, field_type);
size_t llvm_field_abi_align = LLVMABIAlignmentOfType(g->target_data_ref, field_llvm_type);
@@ -7999,7 +8003,7 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS
TypeStructField *field = struct_type->data.structure.fields[i];
ZigType *field_type = field->type_entry;
- if (!type_has_bits(field_type)) {
+ if (field->is_comptime || !type_has_bits(field_type)) {
field->gen_index = SIZE_MAX;
continue;
}