mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Crash when doing a type property lookup for const inline enums in some cases #2717.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
12
test/test_suite/enumerations/const_enum.c3
Normal file
12
test/test_suite/enumerations/const_enum.c3
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user