- Crash when doing a type property lookup for const inline enums in some cases #2717.

This commit is contained in:
Christoffer Lerno
2026-01-06 15:28:18 +01:00
parent 702f836b40
commit 9ad98beda7
3 changed files with 14 additions and 1 deletions

View File

@@ -50,6 +50,7 @@
- Fix the case where `\u<unicode char>` could crash the compiler on some platforms.
- Designated initialization with ranges would not error on overflow by 1.
- `io::read_fully` now handles unbounded streams properly.
- Crash when doing a type property lookup for const inline enums in some cases #2717.
### Stdlib changes
- Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads.

View File

@@ -1037,7 +1037,7 @@ Decl *sema_resolve_type_method(SemaContext *context, CanonicalType *type, const
goto RETRY;
case TYPE_ENUM:
case TYPE_CONST_ENUM:
type = enum_inner_type(type);
type = enum_inner_type(type)->canonical;
goto RETRY;
default:
UNREACHABLE

View File

@@ -0,0 +1,12 @@
import std::io;
enum MyEnum : const inline CInt
{
FOO = 1,
BAR = 5,
BAZ = 9,
}
fn void main()
{
io::printn(MyEnum.lookup(2)); // #error: No method or inner struct/union 'MyEnum.lookup' found
}