Skip to content

Commit

Permalink
2024 day 24: fix compilation errors with clang++-15
Browse files Browse the repository at this point in the history
  • Loading branch information
yut23 committed Jan 30, 2025
1 parent 5d577fb commit b756f56
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions 2024/src/day24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ int main(int argc, char **argv) {

// part 2
// check addition for errors 1 bit at a time
const auto check_addition = [&sim](std::uint64_t x, std::uint64_t y,
bool mark) {
const auto check_addition = [&sim = sim](std::uint64_t x, std::uint64_t y,
bool mark) {
std::uint64_t expected = x + y;
sim.evaluate(x, y);
std::uint64_t z = sim.z_value();
Expand Down Expand Up @@ -63,7 +63,8 @@ int main(int argc, char **argv) {
};

// check entire truth table for the adder for bit i
const auto check_bit = [&sim, &check_addition](int i, bool mark = false) {
const auto check_bit = [&sim = sim, &check_addition](int i,
bool mark = false) {
if (i >= sim.num_bits) {
// the most-significant bit was tested as the carry out from the
// previous bit
Expand Down

0 comments on commit b756f56

Please sign in to comment.