In reply to chr_sue:
I removed the field macro, and added factory registration in base class, but the same compile error is still there. below are my classes:
class base_data extends uvm_sequence_item;
`uvm_object_utils(base_data);
//constructor
endclass
class my_data extends base_data;
rand int val;
`uvm_object_utils(my_data); //compiler complains this line have token ‘#’
//constructors, constraints, etc
endclass