Error message: Application of the irf function to a SVAR-model (time series analysis)

I estimated a structural autoregressive model with the following R commands:

#estimate VAR-model
var=VAR(dat, p=2)
#define A and B matrix
A=matrix(c(1,0,NA,1),byrow=TRUE,nrow=2)
B=matrix(c(NA,0,0,NA),byrow=TRUE,nrow=2)
#estimate SVAR-model
svar=SVAR(x, Amat = A, Bmat = B)

When I try to calculate the impulse response functions with the R command:
irf(svar)
the following error message appears:

Error in diag<-(*tmp*, value = 1) :
only matrix diagonals can be replaced

Can someone explain the error message to me?
How do I apply the irf function to a svar model?