Debian Codegraph @

gcc/testsuite/g++.dg/tree-ssa/pr46228.C

raw
1 // { dg-options "-fdump-tree-optimized -Os" }
2 // { dg-skip-if "requires hosted libstdc++ for set" { ! hostedlib } }
3 #include <set>
4 #include <stdio.h>
5
6 int main()
7 {
8 static const int array[] = { 1,2,3,4,5,6,7,8,9,10,6 };
9 std::set<int> the_set;
10 int count = 0;
11 for (unsigned i = 0; i < sizeof(array)/sizeof(*array); i++)
12 {
13 std::pair<std::set<int>::iterator, bool> result =
14 the_set.insert(array[i]);
15 if (result.second)
16 count++;
17 }
18 printf("%d unique items in array.\n", count);
19 return 0;
20 }
21
22 // This function is small enough to be inlined even at -Os.
23 // { dg-final { scan-tree-dump-not "_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEED2Ev" "optimized" } }