We could make a custom attribute for types that should be always passed by 
value and then maybe have Clang handle that. The problem seems generic enough 
that maybe other people could find this useful.

- Raphael

> On 24 Jul 2020, at 09:27, Pavel Labath via lldb-commits 
> <lldb-commits@lists.llvm.org> wrote:
> 
> On 23/07/2020 18:24, Adrian Prantl wrote:
>> Is there some clever C++ way to prohibit taking an object's address (similar 
>> to how you can delete a copy constructor)?
>> 
>> -- adrian
> 
> You could =delete the address-of operator, but redefining unary & is
> generally frowned upon and I am not sure it will achieve what you want
> -- it would not prevent anyone from binding a reference to an existing
> object.
> 
> I don't think there's any way to prevent that, and even if it were, it
> would likely break too much generic code which expects to accept objects
> by const&.
> 
> pl
> _______________________________________________
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to