[qfcc] Add failing nil return through @param bug

I suspect it's general for struts, but nil really is a troubling
character sometimes.
This commit is contained in:
Bill Currie 2020-03-27 19:01:26 +09:00
parent 9e529d1508
commit 9c556c07bb
2 changed files with 36 additions and 0 deletions

View file

@ -53,6 +53,7 @@ test_progs_dat=\
ivar-struct-return.dat \
methodparams.dat \
modulo.dat \
nilparamret.dat \
paramret.dat \
quaternion.dat \
return-ivar.dat \
@ -322,6 +323,15 @@ modulo.run: Makefile build-run
include ./$(DEPDIR)/modulo.Qo # am--include-marker
r_depfiles_remade += ./$(DEPDIR)/modulo.Qo
nilparamret_dat_SOURCES=nilparamret.r
nilparamret_obj=$(nilparamret_dat_SOURCES:.r=.qfo)
nilparamret.dat$(EXEEXT): $(nilparamret_obj) $(QFCC_DEP)
$(QFCC) $(QCFLAGS) -o $@ $(nilparamret_obj)
nilparamret.run: Makefile build-run
@$(srcdir)/build-run $@
include ./$(DEPDIR)/nilparamret.Qo # am--include-marker
r_depfiles_remade += ./$(DEPDIR)/nilparamret.Qo
paramret_dat_SOURCES=paramret.r
paramret_obj=$(paramret_dat_SOURCES:.r=.qfo)
paramret.dat$(EXEEXT): $(paramret_obj) $(QFCC_DEP)

View file

@ -0,0 +1,26 @@
typedef struct bar {
float x, y, z, w;
} bar;
bar set_return();
@param foo()
{
set_return();
return nil;
}
bar set_return()
{
return {1, 2, 3, 4};
}
void printf (string fmt, ...) = #0;
int main()
{
@param r = foo();
printf("%q\n", r);
return !(r.quaternion_val.x == 0
&& r.quaternion_val.y == 0
&& r.quaternion_val.z == 0
&& r.quaternion_val.w == 0);
}