Re: [PATCH v2] infcall: Add support for integer literals as reference function paramters

Tom Tromey
2025-10-22T13:22:47Z

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

>> I don't know if that property (trivially-copyable) is all that easy to
>> detect in gdb, but if it is, I guess it would make sense to detect it
>> and throw an exception. Since in that case we'd be looking at something
>> like a callee that wants memory but where the object has been SROA'd or
>> something along those lines.

Andrew> We have `language_pass_by_reference`, the return value of which will, I
Andrew> think, tell you if a type is trivially-copyable or not. I don't think
Andrew> this is going to be the common path though; don't objects that are not
Andrew> trivially-copyable have to live in memory? I'm sure there might be some
Andrew> edge case here, but for me, I'd be happy with a patch that ignores this
Andrew> for now, and we can come back to this later if/when we find a
Andrew> problematic case.

Yeah, that seems sensible.

I don't really know if compilers are capable of doing weird stuff like
scalar replacement of a non-trivially-destructible object combined with
inlining of the destructor the avoid needing the object in one piece.

Tom