If I pass by reference instead (
bar(Storage<type> &n)
), both versions generate the same assembly (the one with addq
). Probably something about the allocator prevents it from being passed in a register? Cppreference says it has non-trivial (despite being empty) constructor and destructor, probably that's why. Quite a shame.