https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104547

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
If we have two versions of the function in the same TU:

#include <vector>

void shrink(std::vector<int>& v, unsigned n) {
    v.resize(v.size() - n);
}

void shrink_min(std::vector<int>& v, unsigned n) {
    v.resize(std::min<std::size_t>(v.size(), n));
}

Then the .s file contains an instantiation of vector::_M_default_append even
though neither of the functions calls it. Why isn't that eliminated as dead
code? We shouldn't need to keep an implicit instantiation of a non-inline
function template if it's not called.

Reply via email to