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

This commit is contained in:
John Kessenich
2017-08-19 17:29:44 -06:00
parent b207daa5d3
commit 778806a692
3 changed files with 84 additions and 82 deletions

View File

@@ -2239,7 +2239,7 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT
value = intermediate.addConversion(EOpReturn, *currentFunctionType, value);
if (value && *currentFunctionType != value->getType())
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", "");
return value;
}