In reply to dpanda:
You did not set a default value for crc_bits.
It has to be
function crc_size crc_calc(crc_size crc ,bit data, int crc_bits = 7, int crc_polynomial);
Now crc_bits has a fixed value at elaboration, but it can be overridden by any other value later on. The default value can be any other number.