Debian Codegraph @

libstdc++-v3/testsuite/23_containers/list/requirements/completeness.cc

raw
1 // { dg-do compile }
2
3 // C++17 [list.overview]
4 // An incomplete type T may be used when instantiating list if the allocator
5 // satisfies the allocator completeness requirements (20.5.3.5.1).
6 // T shall be complete before any member of the resulting specialization
7 // of list is referenced.
8
9 #include <list>
10
11 struct Incomplete;
12
13 // This instantiates std::list, but none of its members.
14 const int sz = sizeof(std::list<Incomplete>);
15
16 // Technically the following references a member of std::list, but because
17 // our iterators are SCARY it doesn't instantiate any members of std::list.
18 // GCC's own source code expects this to work.
19 std::list<Incomplete>::iterator i = std::list<Incomplete>::iterator();