c++: Fix diagnostic for binding lvalue reference to volatile rvalue [PR 100635]
authorJonathan Wakely <jwakely@redhat.com>
Mon, 17 May 2021 09:53:56 +0000 (10:53 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 17 May 2021 20:04:31 +0000 (21:04 +0100)
commit5d93261bc03c9c6891ccd8c77ab22b2a09971905
tree5c51a0e81baf9fe78daa93a319f38b5682fb718b
parent09867aa0ef7568012650395189b735f9a34cf9b5
c++: Fix diagnostic for binding lvalue reference to volatile rvalue [PR 100635]

The current diagnostic assumes the reference binding fails because the
reference is non-const, but it can also fail if the rvalue is volatile.

Use the current diagnostic for non-const cases, and a modified
diagnostic otherwise.

gcc/cp/ChangeLog:

PR c++/100635
* call.c (convert_like_internal): Print different diagnostic if
the lvalue reference is const.

gcc/testsuite/ChangeLog:

* g++.dg/conversion/pr100635.C: New test.
gcc/cp/call.c
gcc/testsuite/g++.dg/conversion/pr100635.C [new file with mode: 0644]