Odin
Odin copied to clipboard
Confusing compiler error message
package bug2
import win32 "core:sys/windows"
backbuffer: win32.BITMAPINFO
main :: proc() {
backbuffer.bmiHeader.biSize = size_of(win32.BITMAPINFO.bmiHeader)
}
Compiler error:
'win32.BITMAPINFO' of type 'BITMAPINFO' has no field 'bmiHeader'
Suggestion: Did you mean?
bmiHeader
The syntax in your code example is not valid. In order to access struct fields you need an instantiated struct.
The following will solve the Issue:
size_of(win32.Bitmap_Info{}.header) // struct instantiation with {}
As side note, you would access "constant fields" of a struct with your syntax.
Foo :: struct(N: int) {}
num := Foo(42).N
However, the compiler error message is highly confusing and should be corrected (so maybe keep this Issue open).
However, the compiler error message is highly confusing and should be corrected (so maybe keep this Issue open).
Yes, that is indeed the issue, not my syntax, but the compiler reaction to it.
Hello!
I am marking this issue as stale as it has not received any engagement from the community or maintainers 120 days. That does not imply that the issue has no merit! If you feel strongly about this issue
- open a PR referencing and resolving the issue;
- leave a comment on it and discuss ideas how you could contribute towards resolving it;
- leave a comment and describe in detail why this issue is critical for your use case;
- open a new issue with updated details and a plan on resolving the issue.
The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone..
Updated code:
package bug2
import win32 "core:sys/windows"
backbuffer: win32.BITMAPINFO
main :: proc() {
backbuffer.bmiHeader.biSize = size_of(win32.BITMAPINFO.bmiHeader)
}
With recent commits the error became:
Type 'win32.BITMAPINFO' has no field 'bmiHeader'
... buffer.bmiHeader.biSize = size_of(win32. ...
^
However it is still wrong.