On Thu, Sep 13, 2018 at 9:41 AM, Ville Voutilainen <ville.voutilai...@gmail.com> wrote: > On 13 September 2018 at 13:41, Ville Voutilainen > <ville.voutilai...@gmail.com> wrote: >>> How does this work when: >>> unsigned has_complex_copy_ctor : 1; >> It doesn't. I need more bits. Luckily, we have some available. > > Here. I suppose this could theoretically be done in some later stage > of class completion, > but that would presumably be an additional member function loop that > looks at the constructors, > weeds out copy constructors, and calculates the triviality bit (and it > should probably then also > look at fields and bases, again). So while I continue to have a minor > distaste for this whole approach, > and how it wastes two perfectly good bits for a dark corner case, I > think I can learn to live with it.
Really, the problem is that trivial_fn_p shouldn't use type_has_trivial_fn, and also that the function named "type_has_trivial_fn" actually returns "type has no non-trivial fn". These flags are relics of C++98 semantics. Your test should also check that !__is_trivially_constructible(M,M&) and !__is_trivially_constructible(M2,M2&). I suppose that given the limited number of possibly trivial signatures, we can still use flag bits on the class, as your patch is heading toward: one bit for each of the possibly trivial signatures, and TYPE_HAS_COMPLEX_COPY_CTOR; then TYPE_HAS_COPY_CTOR is the union of these. And similarly for the other possibly trivial functions. Jason