// { dg-do run } // { dg-options "-g" } // Copyright (C) 2013-2017 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // . #include #include #include #include template void placeholder(const T &s) { std::cout << s; } template void placeholder(const std::pair &s) { std::cout << s.first; } template void use(const T &container) { for (typename T::const_iterator i = container.begin(); i != container.end(); ++i) placeholder(*i); } int main() { std::tr1::unordered_map eum; // { dg-final { note-test eum "std::tr1::unordered_map with 0 elements" } } std::tr1::unordered_multimap eumm; // { dg-final { note-test eumm "std::tr1::unordered_multimap with 0 elements" } } std::tr1::unordered_set eus; // { dg-final { note-test eus "std::tr1::unordered_set with 0 elements" } } std::tr1::unordered_multiset eums; // { dg-final { note-test eums "std::tr1::unordered_multiset with 0 elements" } } std::tr1::unordered_map uom; uom[5] = "three"; uom[3] = "seven"; // { dg-final { note-test uom {std::tr1::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } } std::tr1::unordered_multimap uomm; uomm.insert(std::pair (5, "three")); uomm.insert(std::pair (5, "seven")); // { dg-final { note-test uomm {std::tr1::unordered_multimap with 2 elements = {[5] = "three", [5] = "seven"}} } } std::tr1::unordered_set uos; uos.insert(5); // { dg-final { note-test uos {std::tr1::unordered_set with 1 element = {[0] = 5}} } } std::tr1::unordered_multiset uoms; uoms.insert(5); // { dg-final { note-test uoms {std::tr1::unordered_multiset with 1 element = {[0] = 5}} } } placeholder(""); // Mark SPOT use(eum); use(eumm); use(eus); use(eums); use(uoms); std::cout << "\n"; return 0; } // { dg-final { gdb-test SPOT } }