HLSL: Fix #1018: Give an error for mismatched return type.
This commit is contained in:
parent
b207daa5d3
commit
778806a692
3 changed files with 84 additions and 82 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue