mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Struct and typedef subtypes inherit dynamic functions.
This commit is contained in:
27
test/test_suite/enumerations/enum_inline_interface.c3
Normal file
27
test/test_suite/enumerations/enum_inline_interface.c3
Normal file
@@ -0,0 +1,27 @@
|
||||
module foo;
|
||||
import std;
|
||||
interface Test
|
||||
{
|
||||
fn void x();
|
||||
}
|
||||
|
||||
typedef Foo (Test) = int;
|
||||
|
||||
fn void Foo.x(&self) @dynamic
|
||||
{
|
||||
io::printn("Foo!");
|
||||
}
|
||||
|
||||
enum Tester : inline Foo
|
||||
{
|
||||
ABC
|
||||
}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
Tester x;
|
||||
Test t = &x; // #error: but you can use an explicit cast to
|
||||
t.x();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user