On Tue, Nov 15, 2022 at 6:48 AM Yubin Ruan via Gcc-help <gcc-help@xxxxxxxxxxx> wrote: > > To be sure that a object would not be copied, we usually write something > like > > SomeBigObject obj; > func(&obj); > > while in most of the cases a one-liner like > > SomeBigObject obj = func(); > > would suffice. > > Is there any language facility to help us guarantee that at compile time > (such as some kind of static_assert() ) so that we can be confident writing > those one-liner ? Interesting question, but unfortunately I do not have a good answer! I can only bump the thread. ;)