Closed
Description
Affected rules
A0-1-1
Description
Where an auto
variable is declared in a template function or class, the copy of the variable in the uninstantiated template may be considered "unused", even though it is considered used in at least one instantiation.
Example
#include <vector>
template <typename T> void test_range_based_for_loop_template() {
std::vector<A> values_;
for (auto &elem : values_) { // COMPLIANT - should not report either elem or
// the compiler generated (__range)
// variable in the uninstantiated
// template
elem;
}
}
// Instantiate the template
void test_template() { test_range_based_for_loop_template<A>(); }