News for hackers. Stuff that matters.
Re:Switching from C++ to Rust by jcranmer on Tuesday March 14, 2023 @12:24AM (#35147432)
> can't have any types w/ non-trival copy constructors in a union, though, apparently, which is quite the restriction.

That was removed in C++11. The rule now is:

> Absent default member initializers ([class.mem]), if any non-static data member of a union has a non-trivial default constructor ([class.default.ctor]), copy constructor, move constructor ([class.copy.ctor]), copy assignment operator, move assignment operator ([class.copy.assign]), or destructor ([class.dtor]), the corresponding member function of the union must be user-provided or it will be implicitly deleted ([dcl.fct.def.delete]) for the union.

i.e., you need to provide an explicit version of the special function for the union if any member has a nontrivial implementation.

Re:Switching from C++ to Rust by dilap on Tuesday March 14, 2023 @12:38PM (#35154258)
ah, good to know, thanks! unfortunately too late to edit my comment