Fix somelist_pointer
This commit is contained in:
parent
c3e12b087a
commit
668e18e8ba
@ -256,8 +256,7 @@ namespace AST {
|
|||||||
|
|
||||||
|
|
||||||
codegen::StackValue IndexAccessExpression::codegen(codegen::Builder& builder, codegen::Scope& scope) {
|
codegen::StackValue IndexAccessExpression::codegen(codegen::Builder& builder, codegen::Scope& scope) {
|
||||||
auto lvalue_scope = scope.with_lvalue();
|
auto value = this->m_expr->codegen(builder, scope);
|
||||||
auto value = this->m_expr->codegen(builder, lvalue_scope);
|
|
||||||
std::shared_ptr<types::Type> inner_ty{};
|
std::shared_ptr<types::Type> inner_ty{};
|
||||||
|
|
||||||
std::vector<llvm::Value*> idx_list{ };
|
std::vector<llvm::Value*> idx_list{ };
|
||||||
|
|||||||
2
test.c
2
test.c
@ -29,10 +29,12 @@ int main() {
|
|||||||
printf(text, fibonacci(10));
|
printf(text, fibonacci(10));
|
||||||
|
|
||||||
char somelist[5] = { 1, 2, 3, 4, 5 };
|
char somelist[5] = { 1, 2, 3, 4, 5 };
|
||||||
|
char* somelist_ptr = somelist;
|
||||||
|
|
||||||
change_first(somelist);
|
change_first(somelist);
|
||||||
|
|
||||||
printf("first element: %d!\n", somelist[0]);
|
printf("first element: %d!\n", somelist[0]);
|
||||||
|
printf("first element via ptr: %d!\n", somelist_ptr[0]);
|
||||||
|
|
||||||
struct Otus otus = { 5 };
|
struct Otus otus = { 5 };
|
||||||
update(otus);
|
update(otus);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user