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

cpp panic when comparing struct with it's subtype #3689

Open
thetarnav opened this issue Jun 5, 2024 · 0 comments
Open

cpp panic when comparing struct with it's subtype #3689

thetarnav opened this issue Jun 5, 2024 · 0 comments

Comments

@thetarnav
Copy link
Contributor

thetarnav commented Jun 5, 2024

A compiler panic when comparing a struct with another that it's using as a subtype.

CODE

Outer :: struct {
    using inner: struct {a: int},
    b: int,
}

outer: Outer
if outer == outer.inner {
    // 	(ノ ゜Д゜)ノ ︵ ┻━┻
}

OUTPUT

$ odin run .
bug.main
lb_emit_conv: src -> dst
Not Identical struct {a: int} != Outer
Not Identical struct {a: int} != struct {inner: struct {a: int}, b: int}
Not Identical 7460decd7a30 != 7460decd78a0
Not Identical 7460decd7a30 != 7460decd7930
src/llvm_backend_expr.cpp(2324): Panic: Invalid type conversion: 'struct {a: int}' to 'Outer' for procedure 'bug.main'
Illegal instruction (core dumped)

REPORT

	Odin:    dev-2024-06:cdd90a9a0
	OS:      Ubuntu 22.04.4 LTS, Linux 6.5.0-35-generic
	CPU:     Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
	RAM:     7631 MiB
	Backend: LLVM 17.0.6
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

1 participant