Skip to content

Commit c19e88a

Browse files
committed
Resolve problem with casts of a single argument to vector types
1 parent e54f6c5 commit c19e88a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

source/modules/soul_core/compiler/soul_ResolutionPass.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,15 @@ struct ResolutionPass final
11471147
}
11481148
else if (targetType.isArrayOrVector())
11491149
{
1150+
if (numArgs == 1)
1151+
{
1152+
if (auto constant = list.items.front()->getAsConstant())
1153+
if (TypeRules::canCastTo (targetType, constant->value.getType()))
1154+
return allocator.allocate<AST::Constant> (expr.context, constant->value.castToTypeExpectingSuccess (targetType));
1155+
1156+
return expr;
1157+
}
1158+
11501159
SanityCheckPass::throwErrorIfWrongNumberOfElements (expr.context, targetType, numArgs);
11511160

11521161
auto elementType = targetType.getElementType();

0 commit comments

Comments
 (0)