mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Improve lvalue handling in the compiler. #1357
This commit is contained in:
19
test/unit/regression/lvalue_handling.c3
Normal file
19
test/unit/regression/lvalue_handling.c3
Normal file
@@ -0,0 +1,19 @@
|
||||
module lvalue_handling;
|
||||
import std;
|
||||
struct Foo
|
||||
{
|
||||
int a;
|
||||
}
|
||||
def IntList = List(<Foo>);
|
||||
fn void subscript_overload() @test
|
||||
{
|
||||
IntList x;
|
||||
x.push({ 3 });
|
||||
int* a = &x[0].a;
|
||||
assert(*a == 3);
|
||||
assert(x[0].a == 3);
|
||||
*a = 4;
|
||||
assert(x[0].a == 4);
|
||||
x[0].a = 5;
|
||||
assert(x[0].a == 5);
|
||||
}
|
||||
Reference in New Issue
Block a user