[Bug c++/53036] [c++11] trivial class fails std::is_trivial test

marc.glisse at normalesup dot org gcc-bugzilla@gcc.gnu.org
Thu Apr 19 06:31:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53036

Marc Glisse <marc.glisse at normalesup dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marc.glisse at normalesup
                   |                            |dot org

--- Comment #1 from Marc Glisse <marc.glisse at normalesup dot org> 2012-04-19 06:28:57 UTC ---
(In reply to comment #0)
> In my understanding of the new C++ standard, the following code should compile.
> It does not.
> 
>   struct D
>   {
>       D() = default;
>       D(D const &) = default;
>       template<typename ...U>
>       constexpr D(U ...u)
>       {}
>   };
>   static_assert(std::is_trivial<D>::value, "here");

With the declarations in this order, it seems easy to fix, in
grok_special_member_properties, only set TYPE_HAS_COMPLEX_DFLT to 1 if we
didn't already have TYPE_HAS_DEFAULT_CONSTRUCTOR (might have hidden issues, but
they are not obvious to me).

Now if you put the defaulted constructor after the user-provided variadic one,
it becomes much harder, and it looks like we'd have to remember one extra bit
of information: the reason why we set TYPE_HAS_COMPLEX_DFLT.



More information about the Gcc-bugs mailing list