Parameter nan not working

Could anyone please explain to me why this code does not work? It works when nan is not a parameter. In many situations, I want to export a parameter nan from a module but couldn’t do so.

program test
  use ieee_arithmetic
  real(8), parameter :: nan = ieee_value(0d0, ieee_quiet_nan)
  print *, nan
end program