https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58055
--- Comment #6 from marc at kdab dot com --- To expand on my previous comment: the compiler is even allowed to elide the copy if that would save a read/write from a volatile object. So I don't see how this can be implemented anywhere except the front-end.