MikePopoloski / slang

SystemVerilog compiler and language services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

-Wcomparison-mismatch and enum-value types

jrudess opened this issue · comments

If an enum-value with a defined type is used in a comparison and that type matches the other side of the comparison, a warning still triggers.

Is it possible to relax the warning for the case of enum-values, or have I missed anything?

slangtest169.sv:12:18: warning: comparison between operands of different types ('int' and 'e_t') [-Wcomparison-mismatch]
        v.size() == E;
        ~~~~~~~~ ^~ ~
class C;

    typedef enum int {
        A = 0,
        C = 2,
        E = 4
    } e_t;

    rand bit v[$];

    constraint q {
        v.size() == E;
    }

endclass