This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH 2/2] libstdc++: Add std::aligned_union.
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Rüdiger Sonderfeld <ruediger at c-plusplus dot de>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 16 Apr 2014 16:29:09 +0100
- Subject: Re: [PATCH 2/2] libstdc++: Add std::aligned_union.
- Authentication-results: sourceware.org; auth=none
- References: <5d1b2765297b384d5f278f9b389723249930ee7c dot 1397660778 dot git dot ruediger at c-plusplus dot de> <4748359 dot R5JtmCrB3i at descartes>
On 16/04/14 17:06 +0200, Rüdiger Sonderfeld wrote:
C++11: [meta.trans.other]
* libstdc++-v3/testsuite/20_util/aligned_union/1.cc: New file.
* libstdc++-v3/include/std/type_traits (__strictest_alignment): New
helper struct.
(aligned_union): New struct (C++11).
(aligned_union_t): New type alias (C++14).
Thanks! I was hoping to implement it the straightforward way, but was
thwarted by http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59012
+ template <typename... _Types>
+ struct __strictest_alignment
+ {
+ static const size_t _M_alignment = 0;
+ static const size_t _M_size = 0;
The naming convention is to use _S_xxx for static members
+ template <size_t Len, class... Types>
+ using aligned_union_t = typename aligned_union<Len,Types...>::type;
It should be s/class/typename/ here.
Is <initializer_list> needed for the testcase?
The testcase can use { dg-do compile } to turn it into a compile-only
test, and then doesn't need a main() function.
Otherwise I think this looks good, thanks.