Ah, the ever annoying globally/locally static VHDL problem.
This does look like a bug in the VHDL compiler, as all constants are globally static (I just checked the '93 LRM). It probably gets confused by the fact it's an attribute on a record field.
ISE never had a great reputation as a compiler.
Unfortunatly they stopped working on ISE with the final version being 14.7 two years ago. You dont specify what verison you are using, have you tried a newer version?
I just compiled your code in questa using -93 and -pedanticerrors switches on VCOM, and no problems. So I still assume an ISE bug. Unless there is something you're now showing us, you probably wont be able to use 'length on the record.
It should work declaring a constant like this:
Code:
constant R_LEN : integer :=32;
type test_record is record
field1 : std_logic_vector(R_LEN-1 downto 0);
field2 : std_logic_vector(R_LEN-1 downto 0);
end record;
generic map(LEN => R_LEN); -- please use named association not positional
Not sure if this is pertinent (don't know if using records like this work/don't work in '87 vs '93), but doesn't ISE always default to using '87 and not '93, I've run into issues with the VHDL version in the past with ISE, could switching the compile options in ISE to '93 or 200x fix the issue?