Files
c3c/test/test_suite/macros/address_of_macro.c3
Christoffer Lerno 82cc49b388 - !!foo now works same as as ! ! foo.
- Incorrectly allowed getting pointer to a macro #2049.
2025-03-16 23:57:30 +01:00

28 lines
434 B
Plaintext

import std::io;
// Issue #2049
struct Container
{
int[] items;
}
macro int Container.get(&this, usz i) @operator([])
{
return this.items[i];
}
fn int Container.get2(&this, usz i)
{
return this.items[i];
}
alias ProcGetItem = fn int(usz);
fn void process(int input, ProcGetItem getter)
{
}
fn void main()
{
Container c = { .items = { 2, 3, 4, 5 } };
process(10, &c.get); // #error: It's not possible to take the address
}