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