Debian Codegraph @

gcc/testsuite/g++.dg/tree-ssa/allocator-opt1.C

raw
1 // PR c++/105838
2 // { dg-additional-options -fdump-tree-gimple }
3 // { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } }
4
5 // Check that there's only one allocator (temporary) variable.
6 // Currently the dump doesn't print the allocator template arg in this context.
7 // { dg-final { scan-tree-dump-times "struct allocator D" 1 "gimple" } }
8
9 // In the pre-C++11 ABI we get two allocator variables.
10 #undef _GLIBCXX_USE_CXX11_ABI
11 #define _GLIBCXX_USE_CXX11_ABI 1
12
13 #include <string>
14
15 // When the library is not dual-ABI and defaults to old just compile
16 // an empty TU. NB: We test _GLIBCXX_USE_CXX11_ABI again because the
17 // #include above might have undef'd _GLIBCXX_USE_CXX11_ABI.
18 #if _GLIBCXX_USE_CXX11_ABI
19
20 void f (const char *p)
21 {
22 std::string lst[] = { p, p, p, p };
23 }
24
25 #endif