// RUN: %check_clang_tidy -std=c++11-or-later %s portability-std-allocator-const %t -- -- -fno-delayed-template-parsing namespace std { typedef unsigned size_t; template class allocator {}; template class hash {}; template class equal_to {}; template class less {}; template > class deque {}; template > class forward_list {}; template > class list {}; template > class vector {}; template , class A = std::allocator> class multiset {}; template , class A = std::allocator> class set {}; template , class Eq = std::equal_to, class A = std::allocator> class unordered_multiset {}; template , class Eq = std::equal_to, class A = std::allocator> class unordered_set {}; template > class stack {}; } // namespace std namespace absl { template , class Eq = std::equal_to, class A = std::allocator> class flat_hash_set {}; } // namespace absl template class allocator {}; void simple(const std::vector &v, std::deque *d) { // CHECK-MESSAGES: [[#@LINE-1]]:24: warning: container using std::allocator is a deprecated libc++ extension; remove const for compatibility with other standard libraries // CHECK-MESSAGES: [[#@LINE-2]]:52: warning: container std::list l; // CHECK-MESSAGES: [[#@LINE-1]]:8: warning: container std::multiset ms; // CHECK-MESSAGES: [[#@LINE-1]]:8: warning: container std::set> s; // CHECK-MESSAGES: [[#@LINE-1]]:8: warning: container std::unordered_multiset ums; // CHECK-MESSAGES: [[#@LINE-1]]:8: warning: container std::unordered_set us; // CHECK-MESSAGES: [[#@LINE-1]]:8: warning: container absl::flat_hash_set fhs; // CHECK-MESSAGES: [[#@LINE-1]]:9: warning: container using my_vector = std::vector; // CHECK-MESSAGES: [[#@LINE-1]]:26: warning: container my_vector v1; using my_vector2 = my_vector; std::vector neg1; std::vector neg2; // not const T std::vector> neg3; // not use std::allocator std::allocator a; // not caught, but rare std::forward_list forward; // not caught, but rare std::stack stack; // not caught, but rare } template void temp1() { std::vector v; // CHECK-MESSAGES: [[#@LINE-1]]:8: warning: container std::vector neg1; std::forward_list neg2; } void use_temp1() { temp1(); } template void temp2() { // Match std::vector for the uninstantiated temp2. std::vector v; // CHECK-MESSAGES: [[#@LINE-1]]:8: warning: container std::vector neg1; std::forward_list neg2; }