incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Travis Vitek" <>
Subject preconditions for aligned_union
Date Tue, 17 Jun 2008 23:43:18 GMT

I'm looking at the standard, and it appears that the following is

  struct incomplete_t;

  std::aligned_union<0, void, incomplete_t>::type

Does anyone have any idea what the expected behavior of such code would
be? The comments in table 51 of the current draft say

  template <std::size_t Len, class... Types>
  struct aligned_union;

  The member typedef type shall be a pod type suitable for
  use as uninitialized storage for any object whose type is
  listed in Types; its size shall be at least Len. The static
  member alignment_value shall be an integral constant of
  type std::size_t whose value is the strictest alignment
  of all types listed in Types.

The problem is that void and incomplete types don't have a size or
alignment requirements. It appears that this is an oversight in the
standard. The related trait alignment_of<T> requires that T be a
complete type, a reference type, or an array of unknown bound, but not a
function type or cv-void type.

Now I could implement aligned_union<> to ignore incomplete types (they
have no alignment requirement), but this might cause problems if someone
tried to use the result.


View raw message