mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 19:10:14 +01:00
### Description When looking up default initializers for class elements in `ConvertStructToClass`, the compiler previously assumed that every member looked up from the class scope was a `FieldDecl` and called `GetAs<SemIR::FieldDecl>` directly. For a derived class with a base class, looking up `base` returns a `BaseDecl`, which caused a `CHECK` assertion failure when casting to `FieldDecl`. Use `TryGetAs<SemIR::FieldDecl>` instead so non-`FieldDecl` entries like `BaseDecl` are recognized as having no default initializer, cleanly diagnosing that the `base` field is missing. Fixes #7722 Assisted-by: Google Deepmind Antigravity