Skip to content

Shared discriminator does not cause compiler error #3351

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

Open
nobel-sh opened this issue Jan 6, 2025 · 3 comments · May be fixed by #3458
Open

Shared discriminator does not cause compiler error #3351

nobel-sh opened this issue Jan 6, 2025 · 3 comments · May be fixed by #3458
Assignees
Labels
diagnostic diagnostic static analysis HIR typechecking

Comments

@nobel-sh
Copy link
Contributor

nobel-sh commented Jan 6, 2025

The following code should generate a compiler error stating how the same discriminant value is assigned multiple times.

enum Foo {
    Bar = 1,
    Qaz = 1,
}

fn main() {}

But it seems to generate no errors on gccrs.
Godbolt: https://godbolt.org/z/f1aY19v4q

@Harishankar14
Copy link

Harishankar14 commented Jan 12, 2025

which compiler flags are you using ? I guess -Werror flags would help?
Would love to know a bit more about the issue, regarding the versions and stuff , I guess it has been updated.

@Harishankar14
Copy link

Updatedc

@badumbatish
Copy link
Contributor

i'll attempt this problem

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

Successfully merging a pull request may close this issue.

4 participants