complex wave used in real expression

Could some experts explain the error of following codes? The error was like "complex wave used in real expression" start after "endif". It is run on IGOR Pro 6.3

Many thanks,

Wen-Jie

duplicate/O $wave1,w
Variable n=DimSize(w, 0)
if (mod(n, 2)==1)
DeletePoints n-1, 1, w
endif
FFT w
if (f0>0)
w[0, x2pnt(w, f0)]=0
endif
w[x2pnt(w, f1), inf]=0
IFFT w
The issue arises from the fact that Igor still thinks that w is a real wave (and the automatic wave assignment only works with the /DEST flag).
A sloppy work around would go like this or (recommended) use the /DEST flag to create a temporary complex wave
function filter()
make /O test
test=gnoise(1)
fft test
wave /C temp=test
temp[0,x2pnt(test, 0.1)]=0
ifft temp
end


HJ