Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wcomparison-mismatch and enum-value types #1029

Closed
jrudess opened this issue Jun 12, 2024 · 1 comment
Closed

-Wcomparison-mismatch and enum-value types #1029

jrudess opened this issue Jun 12, 2024 · 1 comment

Comments

@jrudess
Copy link
Contributor

jrudess commented Jun 12, 2024

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
@MikePopoloski
Copy link
Owner

Done in 4dcf49d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants