mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Grabbing (missing) methods on function pointers would cause crash #2434.
This commit is contained in:
@@ -67,6 +67,7 @@
|
|||||||
- `has_tagof` on tagged lambdas returns false #2432
|
- `has_tagof` on tagged lambdas returns false #2432
|
||||||
- Properly add "inlined at" for generic instantiation errors #2382.
|
- Properly add "inlined at" for generic instantiation errors #2382.
|
||||||
- Inlining a const as an lvalue would take the wrong path and corrupt the expression node.
|
- Inlining a const as an lvalue would take the wrong path and corrupt the expression node.
|
||||||
|
- Grabbing (missing) methods on function pointers would cause crash #2434.
|
||||||
|
|
||||||
### Stdlib changes
|
### Stdlib changes
|
||||||
- Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`.
|
- Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`.
|
||||||
|
|||||||
@@ -971,6 +971,7 @@ Decl *sema_resolve_type_method(SemaContext *context, CanonicalType *type, const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!type_may_have_method(type)) return NULL;
|
||||||
Decl *type_decl = type->decl;
|
Decl *type_decl = type->decl;
|
||||||
if (!decl_ok(type_decl)) return poisoned_decl;
|
if (!decl_ok(type_decl)) return poisoned_decl;
|
||||||
Methods *methods = type_decl->method_table;
|
Methods *methods = type_decl->method_table;
|
||||||
|
|||||||
14
test/test_suite/methods/method_on_non_valid_type.c3
Normal file
14
test/test_suite/methods/method_on_non_valid_type.c3
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
module app;
|
||||||
|
|
||||||
|
typedef Foo = int;
|
||||||
|
fn void Foo.method(&self)
|
||||||
|
{
|
||||||
|
self.method.anything = null; // #error: There is no member or method
|
||||||
|
}
|
||||||
|
|
||||||
|
fn int main()
|
||||||
|
{
|
||||||
|
Foo bar;
|
||||||
|
bar.method();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user