Skip to content

Commit

Permalink
fix(to_cpp1): lower indexed call in the correct order
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Jan 10, 2024
1 parent 1592581 commit b83dcb8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
In file included from pure2-bugfix-for-indexed-call.cpp:7:
pure2-bugfix-for-indexed-call.cpp2: In function ‘int main()’:
pure2-bugfix-for-indexed-call.cpp2:6:43: error: no match for call to ‘(std::array<void (*)(int), 2>) (cpp2::i32&)’
6 | array_of_functions[index](arguments);
| ~~~~~~~~~~~~~~~ ^
pure2-bugfix-for-indexed-call.cpp2:6:43: error: no match for call to ‘(std::array<void (*)(int), 2>) (cpp2::i32&)’
6 | array_of_functions[index](arguments);
| ~~~~~~~~~~~~~~~ ^
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ auto main() -> int{
std::array array_of_functions {f, f};
auto index {0};
cpp2::i32 arguments {0};
CPP2_ASSERT_IN_BOUNDS(array_of_functions(arguments), index);
CPP2_ASSERT_IN_BOUNDS(array_of_functions, index)(arguments);
static_cast<void>(std::move(array_of_functions));
static_cast<void>(std::move(index));
static_cast<void>(std::move(arguments));
Expand Down
2 changes: 2 additions & 0 deletions source/to_cpp1.h
Original file line number Diff line number Diff line change
Expand Up @@ -3322,6 +3322,8 @@ class cppfront
// Handle the suffix operators that remain suffix
//
else {
flush_args();

assert(i->op);
last_was_prefixed = false;

Expand Down

0 comments on commit b83dcb8

Please sign in to comment.