@@ -29043,11 +29043,24 @@ static Error buf_read_value_bytes(IrAnalyze *ira, CodeGen *codegen, AstNode *sou
29043
29043
case ZigTypeIdStruct:
29044
29044
switch (val->type->data.structure.layout) {
29045
29045
case ContainerLayoutAuto: {
29046
- ErrorMsg *msg = opt_ir_add_error_node(ira, codegen, source_node,
29047
- buf_sprintf("non-extern, non-packed struct '%s' cannot have its bytes reinterpreted",
29048
- buf_ptr(&val->type->name)));
29049
- add_error_note(codegen, msg, val->type->data.structure.decl_node,
29050
- buf_sprintf("declared here"));
29046
+ switch(val->type->data.structure.special){
29047
+ case StructSpecialNone:
29048
+ case StructSpecialInferredTuple:
29049
+ case StructSpecialInferredStruct: {
29050
+ ErrorMsg *msg = opt_ir_add_error_node(ira, codegen, source_node,
29051
+ buf_sprintf("non-extern, non-packed struct '%s' cannot have its bytes reinterpreted",
29052
+ buf_ptr(&val->type->name)));
29053
+ add_error_note(codegen, msg, val->type->data.structure.decl_node,
29054
+ buf_sprintf("declared here"));
29055
+ break;
29056
+ }
29057
+ case StructSpecialSlice: {
29058
+ opt_ir_add_error_node(ira, codegen, source_node,
29059
+ buf_sprintf("slice '%s' cannot have its bytes reinterpreted",
29060
+ buf_ptr(&val->type->name)));
29061
+ break;
29062
+ }
29063
+ }
29051
29064
return ErrorSemanticAnalyzeFail;
29052
29065
}
29053
29066
case ContainerLayoutExtern: {
0 commit comments