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