Open
Description
A class declared in a loop generate block is a class of its own in each elaborated iteration, with that iteration's constants (IEEE 1800-2023 27.4):
for (genvar i = 0; i < 2; i++) begin : g
localparam int K = i + 1;
class C #(int N = K); endclass
initial $display("%0d", C#()::N); // 1 in g[0], 2 in g[1]
endThe analyzer keys class declarations, their declaration scopes and specializations by the class name and source range, so all iterations would share one declaration and one iteration's constants. Since #1796 such classes are rejected ("class C declared in a loop generate block") instead of being silently merged.
Expected
Give each elaborated generate instance its own class identity (declaration scope, specializations, static properties) and lift the rejection.
Found in a review of #1796.
Metadata
Metadata
Assignees
Labels
No labels
Activity