https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99558

--- Comment #2 from J. Hart <jfhart085 at gmail dot com> ---
Thank you very much for your kind attention and assistance.  I had 
thought it was indicating a reference rather than an lvalue.  Your 
correction is most useful and appreciated.  I deliberately introduced 
the second error to demonstrate the first, so the second one was expected.

Thanks again,

J. Hart

On 03/12/2021 06:30 PM, redi at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99558
>
> Jonathan Wakely <redi at gcc dot gnu.org> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>           Resolution|---                         |INVALID
>               Status|UNCONFIRMED                 |RESOLVED
>
> --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> (In reply to J. Hart from comment #0)
>> $ g++ -c -o utl2.o utl2.cc
>> utl2.cc: In function "int main()":
>> utl2.cc:13:5: error: no matching function for call to "cls4::cls4(int&, int)"
>>
>> correct argument type: constant used as argument, first argument is
>> correctly shown as "int"
> GCC is correct. When you use a variable you are passing an lvalue of type int,
> which is what int& means. When you pass a constant it is an rvalue, i.e. int.
>
>> $ g++ -D DBG1 -c -o utl2.o utl2.cc
>> utl2.cc: In function "int main()":
>> utl2.cc:13:5: error: no matching function for call to "cls4::cls4(int, int)"
> Because you're passing two rvalues.
>

Reply via email to