@@ -102,7 +102,7 @@ inline namespace fundamentals_v1
_Storage& operator=(const _Storage&) = delete;
void* _M_ptr;
- aligned_storage<sizeof(_M_ptr), alignof(void*)>::type _M_buffer;
+ unsigned char _M_buffer[sizeof(_M_ptr)];
};
template<typename _Tp, typename _Safe = is_nothrow_move_constructible<_Tp>,
@@ -90,7 +90,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Storage& operator=(const _Storage&) = delete;
void* _M_ptr;
- aligned_storage<sizeof(_M_ptr), alignof(void*)>::type _M_buffer;
+ unsigned char _M_buffer[sizeof(_M_ptr)];
};
template<typename _Tp, typename _Safe = is_nothrow_move_constructible<_Tp>,
new file mode 100644
@@ -0,0 +1,22 @@
+// { dg-options "-Wno-deprecated-declarations" }
+// { dg-do compile { target c++17 } }
+
+// Verify that r15-3419 did not change the layout of std::any
+
+#include <any>
+
+namespace test {
+ class any {
+ union Storage {
+ constexpr Storage() : ptr(nullptr) { }
+ void* ptr;
+ std::aligned_storage<sizeof(ptr), alignof(void*)>::type buffer;
+ };
+
+ void (*manager)(int, const any*, void*);
+ Storage storage;
+ };
+}
+
+static_assert( sizeof(std::any) == sizeof(test::any) );
+static_assert( alignof(std::any) == alignof(test::any) );