https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102586
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |redi at gcc dot gnu.org, | |rodgertq at gcc dot gnu.org --- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I guess for the <atomic> purposes restricting __builtin_clear_padding to trivially copyable types is ok, http://eel.is/c++draft/atomics.types.generic#general-1.1 requires that. But we use __builtin_clear_padding or the infrastructure also for: 1) __builtin_bit_cast constant evaluation 2) OpenMP atomics 3) -fauto-var-init= I don't remember the std::bit_cast case right now, OpenMP atomics are about scalar floats only, 3) will always call it with address of a variable and therefore know the complete object. So perhaps go with your patch and diagnose if the builtin is called on non-trivially copyable type unless it is called with address of a decl?