@@ -83,7 +83,7 @@ const Type* TypeChecker::invalid_cast(const Loc& loc, const Type* type, const Ty
8383
8484const Type* TypeChecker::invalid_simd (const Loc& loc, const Type* elem_type) {
8585 if (should_report_error (elem_type))
86- error (loc, " expected primitive type for simd type component, but got '{}'" , *elem_type);
86+ error (loc, " expected primitive or pointer type for simd type component, but got '{}'" , *elem_type);
8787 return type_table.type_error ();
8888}
8989
@@ -489,7 +489,7 @@ const Type* TypeChecker::infer_array(
489489 if (elem_count == 0 )
490490 return cannot_infer (loc, msg);
491491 auto elem_type = infer_elems ();
492- if (is_simd && !elem_type->template isa <PrimType>())
492+ if (is_simd && !( elem_type->template isa <PrimType>() || elem_type-> template isa <PtrType>() ))
493493 return invalid_simd (loc, elem_type);
494494 return type_table.sized_array_type (elem_type, elem_count, is_simd);
495495}
@@ -509,7 +509,7 @@ const Type* TypeChecker::check_array(
509509 if (is_simd_type (array_type) != is_simd)
510510 return incompatible_type (loc, (is_simd ? " simd " : " non-simd " ) + std::string (msg), expected);
511511 auto elem_type = array_type->elem ;
512- if (is_simd && !elem_type->isa <PrimType>())
512+ if (is_simd && !( elem_type->template isa <PrimType>() || elem_type-> template isa <PtrType>() ))
513513 return invalid_simd (loc, elem_type);
514514 check_elems (elem_type);
515515 if (auto sized_array_type = array_type->isa <artic::SizedArrayType>();
@@ -847,7 +847,7 @@ const artic::Type* TupleType::infer(TypeChecker& checker) {
847847
848848const artic::Type* SizedArrayType::infer (TypeChecker& checker) {
849849 auto elem_type = checker.infer (*elem);
850- if (is_simd && !elem_type->isa <artic::PrimType>())
850+ if (is_simd && !( elem_type->template isa <artic::PrimType>() || elem_type-> template isa <artic::PtrType>() ))
851851 return checker.invalid_simd (loc, elem_type);
852852
853853 if (std::holds_alternative<ast::Path>(size)) {
@@ -1022,7 +1022,7 @@ const artic::Type* ArrayExpr::check(TypeChecker& checker, const artic::Type* exp
10221022
10231023const artic::Type* RepeatArrayExpr::infer (TypeChecker& checker) {
10241024 auto elem_type = checker.deref (elem);
1025- if (is_simd && !elem_type->isa <artic::PrimType>())
1025+ if (is_simd && !( elem_type->template isa <artic::PrimType>() || elem_type-> template isa <artic::PtrType>() ))
10261026 return checker.invalid_simd (loc, elem_type);
10271027
10281028 if (std::holds_alternative<ast::Path>(size)) {
0 commit comments