mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
glsl2: Check that returned expressions match the function return type.
From my reading of the specification, implicit conversions are not allowed. ATI seems to agree, though nVidia allows it without warning.
This commit is contained in:
parent
153eca9806
commit
18707eba1c
1 changed files with 11 additions and 3 deletions
|
|
@ -2151,9 +2151,17 @@ ast_jump_statement::hir(exec_list *instructions,
|
|||
opt_return_value->hir(instructions, state);
|
||||
assert(ret != NULL);
|
||||
|
||||
/* FINISHME: Make sure the type of the return value matches the return
|
||||
* FINISHME: type of the enclosing function.
|
||||
*/
|
||||
/* Implicit conversions are not allowed for return values. */
|
||||
if (state->current_function->return_type != ret->type) {
|
||||
YYLTYPE loc = this->get_location();
|
||||
|
||||
_mesa_glsl_error(& loc, state,
|
||||
"`return' with wrong type %s, in function `%s' "
|
||||
"returning %s",
|
||||
ret->type->name,
|
||||
state->current_function->function_name(),
|
||||
state->current_function->return_type->name);
|
||||
}
|
||||
|
||||
inst = new(ctx) ir_return(ret);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue