C++/Sieve: make error when running code

While doing the Sieve exercise in C++, I get the following error:

We received the following error when we ran your code:
make[2]: *** [CMakeFiles/test_sieve.dir/build.make:70: CMakeFiles/test_sieve] Error 4
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/test_sieve.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I’m not sure what it means, and what can be done about it. When my solution has some syntax error, or something else, things proceed normally and I get the appropriate error, but after I’ve fixed those, the above is what I get. Here’s how my solution looks at the moment, in case that’s relevant:
sieve.h

#ifndef SIEVE_H
#define SIEVE_H

#include <vector>

namespace sieve {
    const std::vector<int> primes(int upper_limit);
}

#endif

sieve.cpp

#include "sieve.h"
#include <numeric>
#include <vector>

namespace sieve {
    const std::vector<int> primes(int upper_limit) {
        std::vector<int> nums(upper_limit - 1);
        std::iota(nums.begin(), nums.end(), 2);
        for (int i{0}; i < upper_limit - 1; i++) {
            if (nums.at(i) == 0) {
                continue;
            }
            int current_prime{nums.at(i)};
            for (int j{i + 1}; j < upper_limit + 1; j++) {
                if (nums.at(j) % current_prime == 0) {
                    nums[j] = 0;
                }
            }
        }
        std::vector<int> result{};
        for (auto elem : nums) {
            if (elem != 0) {
                result.push_back(elem);
            }
        }
        return result;
    }
}

Output like that is often an indicator that the program produces a segmentation fault or something similar.

Does your solution access a std::vector out of bounds?
Are all limits correct?

Hint

Take a look at the inner loop, where nums[j] is set to 0.
Is j guaranteed to be within bounds?