@@ -401,4 +401,42 @@ void test_compliant_pointers() {
401401 int *q = &y; // COMPLIANT: raw pointer to static storage, no heap involved
402402}
403403
404+ void test_explicit_calls_to_RAII_destructors_of_containers_or_strings () {
405+ std::vector<int > v; // NON_COMPLIANT: uses std::allocator
406+ std::deque<int > d; // NON_COMPLIANT: uses std::allocator
407+ std::list<int > l; // NON_COMPLIANT: uses std::allocator
408+ std::forward_list<int > fl; // NON_COMPLIANT: uses std::allocator
409+ std::set<int > s; // NON_COMPLIANT: uses std::allocator
410+ std::map<int , int > m; // NON_COMPLIANT: uses std::allocator
411+ std::multiset<int > ms; // NON_COMPLIANT: uses std::allocator
412+ std::multimap<int , int > mm; // NON_COMPLIANT: uses std::allocator
413+ std::unordered_set<int > us; // NON_COMPLIANT: uses std::allocator
414+ std::unordered_multiset<int > ums; // NON_COMPLIANT: uses std::allocator
415+ std::unordered_multimap<int , int > umm; // NON_COMPLIANT: uses std::allocator
416+ std::valarray<int > va; // NON_COMPLIANT: uses std::allocator
417+
418+ v.~vector (); // NON_COMPLIANT: explicit call to RAII destructor
419+ d.~deque (); // NON_COMPLIANT: explicit call to RAII destructor
420+ l.~list (); // NON_COMPLIANT: explicit call to RAII destructor
421+ fl.~forward_list (); // NON_COMPLIANT: explicit call to RAII destructor
422+ s.~set (); // NON_COMPLIANT: explicit call to RAII destructor
423+ m.~map (); // NON_COMPLIANT: explicit call to RAII destructor
424+ ms.~multiset (); // NON_COMPLIANT: explicit call to RAII destructor
425+ mm.~multimap (); // NON_COMPLIANT: explicit call to RAII destructor
426+ us.~unordered_set (); // NON_COMPLIANT: explicit call to RAII destructor
427+ ums.~unordered_multiset (); // NON_COMPLIANT: explicit call to RAII destructor
428+ umm.~unordered_multimap (); // NON_COMPLIANT: explicit call to RAII destructor
429+ va.~valarray (); // NON_COMPLIANT: explicit call to RAII destructor
430+
431+ std::string str; // NON_COMPLIANT: uses std::allocator
432+ std::wstring wstr; // NON_COMPLIANT: uses std::allocator
433+ std::u16string u16str; // NON_COMPLIANT: uses std::allocator
434+ std::u32string u32str; // NON_COMPLIANT: uses std::allocator
435+
436+ str.~basic_string (); // NON_COMPLIANT: explicit call to RAII destructor
437+ wstr.~basic_string (); // NON_COMPLIANT: explicit call to RAII destructor
438+ u16str.~basic_string (); // NON_COMPLIANT: explicit call to RAII destructor
439+ u32str.~basic_string (); // NON_COMPLIANT: explicit call to RAII destructor
440+ }
441+
404442int main () { return 0 ; }
0 commit comments