On Wed, Nov 30, 2016 at 8:27 AM, Jonathan Wakely wrote: > On 26/11/16 21:38 -0800, Tim Shen wrote: >> + template<typename _Type, bool = std::is_literal_type_v<_Type>> >> struct _Uninitialized; > > > I'm still unsure that is_literal_type is the right trait here. If it's > definitely right then we should probably *not* deprecate it in C++17!
No it's not right. We need this only because [basic.types]p10.5.3 (in n4606): if it (a literal type) is a union, at least one of its non-static data members is of non-volatile literal type, ... is not implemented. In the current GCC implementation, however, all non-static data members need to be literal types, in order to create a literal union. With the current GCC implementation, to keep our goal, which is to make _Variadic_union literal type, we need to ensure that _Uninitialized<T> is literal type, by specializing on T: 1) If is_literal_type_v<T>, store a T; 2) otherwise, store a raw buffer of T. In the future, when [basic.types]p10.5.3 is implemented, we don't need is_literal_type_v. I'll add a comment here. I didn't check for other compilers. -- Regards, Tim Shen