This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 0/2] Make chained function calls in expressions work
- From: Siva Chandra <sivachandra at google dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Tue, 21 Oct 2014 14:07:00 -0700
- Subject: Re: [PATCH 0/2] Make chained function calls in expressions work
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gzJ6vNSZrQDLbV7dv8gYLzTGAR3JcRagJNWWPoHPo4m7w at mail dot gmail dot com> <201410211115 dot s9LBFkro030607 at d06av02 dot portsmouth dot uk dot ibm dot com> <CAGyQ6gzHfLATvfUZVWzxvM+D_b=JQ2VAUoRpyAAxq6TDrYnA3Q at mail dot gmail dot com>
On Tue, Oct 21, 2014 at 1:30 PM, Siva Chandra <sivachandra@google.com> wrote:
> On Tue, Oct 21, 2014 at 4:15 AM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
>> I was not refering to the ABI, but the C++ standard semantics that
>> define what happen when you pass an *object* as argument to a function
>> that expects a *reference* parameter. See e.g.:
>> http://en.cppreference.com/w/cpp/language/reference_initialization
>>
>> References are initialized in the following situations:
>> [...]
>> 3) In a function call expression, when the function parameter
>> has reference type
>> [...]
>> The effects of reference initialization are:
>> [...]
>> if the reference is [...] lvalue reference to const:
>> [...]
>> a temporary of type T is constructed and copy-initialized from
>> object. The reference is then bound to this temporary
>
> I do not think applies in general for const references. IIUC, it
> applies to prvalues/literals [section 12.2 in the C++ std]. For all
> other kind of values, the two cases above this point should be
> applied.
I should have said prvalues of non-class type.
> Function arguments could be xvalues. IIUC, temporaries are created
> only for prvalues. You can point me to the appropriate section in the
> C++ standard if I am wrong.
Same here.