Commit 778806a6 by John Kessenich

HLSL: Fix #1018: Give an error for mismatched return type.

parent b207daa5
...@@ -8,5 +8,5 @@ float4 main(int i, S input[3]) : COLOR0 ...@@ -8,5 +8,5 @@ float4 main(int i, S input[3]) : COLOR0
S a[3]; S a[3];
input = a; input = a;
return float3(1.0); return a[1].pos;
} }
...@@ -2239,7 +2239,7 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT ...@@ -2239,7 +2239,7 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT
value = intermediate.addConversion(EOpReturn, *currentFunctionType, value); value = intermediate.addConversion(EOpReturn, *currentFunctionType, value);
if (value && *currentFunctionType != value->getType()) if (value && *currentFunctionType != value->getType())
value = intermediate.addUniShapeConversion(EOpReturn, *currentFunctionType, value); value = intermediate.addUniShapeConversion(EOpReturn, *currentFunctionType, value);
if (value == nullptr) { if (value == nullptr || *currentFunctionType != value->getType()) {
error(loc, "type does not match, or is not convertible to, the function's return type", "return", ""); error(loc, "type does not match, or is not convertible to, the function's return type", "return", "");
return value; return value;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment