#initialization
2 posts tagged #initialization.
An empty constructor written {} stops {} from zeroing the object
With the empty constructor spelled = default in the class, T() and T{} zero a class and the class stays trivial. Spelled {} or defined outside the class, neither zeroes it and the class is not trivial. On GCC 16.2 and Clang 22.1 the difference shows in constant expressions, in traits and in what a read of an unset member gives.
What the initialization profile says about code it was not written for
I ran the examples of P4222R3, the initialization profile, on the two experimental Compiler Explorer builds, plus one case from outside the paper. Both builds reject the paper's wrong examples and accept its right ones, with a handful of differences between them. Neither build says anything about a thread that starts before the member it counts into is initialized.