All challenges
Code AnalysisHard 60s

Use-after-move of a std::string argument

What is the problem with this function?
Starter code
#include <string>
#include <utility>

std::string process(std::string s) {
    std::string copy = s;
    std::string out = std::move(s);
    return copy + s;
}

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle