mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 02:11:19 +00:00
Gracefully handle returning NIL though a bad type.
This commit is contained in:
parent
c460e3c979
commit
e28ee0378f
2 changed files with 19 additions and 0 deletions
|
@ -2138,6 +2138,8 @@ return_expr (function_t *f, expr_t *e)
|
|||
if (e->type == ex_nil) {
|
||||
t = f->def->type->aux_type;
|
||||
e->type = expr_types[t->type];
|
||||
if (e->type == ex_nil)
|
||||
return error (e, "invalid return type for NIL");
|
||||
} else {
|
||||
if (!options.traditional)
|
||||
return error (e, "void value not ignored as it ought to be");
|
||||
|
|
|
@ -1 +1,18 @@
|
|||
Class x = NIL;
|
||||
|
||||
struct Size {
|
||||
integer x;
|
||||
integer y;
|
||||
};
|
||||
typedef struct Size Size;
|
||||
|
||||
@interface foo
|
||||
-(Size) bar;
|
||||
@end
|
||||
@implementation foo
|
||||
-(Size) bar
|
||||
{
|
||||
local Size s;
|
||||
return NIL;
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue