[Bug c++/100635] error: cannot bind non-const lvalue reference of type 'const volatile int&' to ...

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 17 20:04:49 GMT 2021


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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:5d93261bc03c9c6891ccd8c77ab22b2a09971905

commit r12-849-g5d93261bc03c9c6891ccd8c77ab22b2a09971905
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon May 17 10:53:56 2021 +0100

    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.


More information about the Gcc-bugs mailing list