| 1 | // { dg-options "-Wno-deprecated-declarations" } |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | |
| 4 | // Verify that r15-3419 did not change the layout of std::any |
| 5 | |
| 6 | #include <any> |
| 7 | |
| 8 | namespace test { |
| 9 | class any { |
| 10 | union Storage { |
| 11 | constexpr Storage() : ptr(nullptr) { } |
| 12 | void* ptr; |
| 13 | std::aligned_storage<sizeof(ptr), alignof(void*)>::type buffer; |
| 14 | }; |
| 15 | |
| 16 | void (*manager)(int, const any*, void*); |
| 17 | Storage storage; |
| 18 | }; |
| 19 | } |
| 20 | |
| 21 | static_assert( sizeof(std::any) == sizeof(test::any) ); |
| 22 | static_assert( alignof(std::any) == alignof(test::any) ); |