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

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

https://gcc.gnu.org/g:75b7b7fdc4597170f24c069ea13aa3e14f37fde7

commit r10-7362-g75b7b7fdc4597170f24c069ea13aa3e14f37fde7
Author: Marek Polacek <pola...@redhat.com>
Date:   Mon Mar 16 10:17:11 2020 -0400

    c++: Fix wrong no post-decrement operator error in template [PR94190]

    Now that convert_like creates an IMPLICIT_CONV_EXPR when it converts
    something that involves a class in a template, we must be prepared to
    handle it.  In this test, we have a class S and we're converting it
    to long int& using a user-defined conversion since we're performing
    -- on it.  So cp_build_unary_op/POSTDECREMENT_EXPR calls
    build_expr_type_conversion which gets the IMPLICIT_CONV_EXPR.  Before
    the convert_like change it got *S::operator long int &(&b) whose type
    is long int but now it gets IMPLICIT_CONV_EXPR<long int&>(b) whose type
    is a reference type.  But the !MAYBE_CLASS_TYPE_P switch doesn't handle
    reference types and so we complain.

    Fixed by calling convert_from_reference on the result of convert_like.

            PR c++/94190 - wrong no post-decrement operator error in template.
            * call.c (convert_like_real): Use convert_from_reference on the
result.

            * g++.dg/conversion/op7.C: New test.

Reply via email to