public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/95508] [10 Regression] ICE on unexpected expression implicit_conv_expr since r10-7096
Date: Wed, 17 Jun 2020 18:39:27 +0000	[thread overview]
Message-ID: <bug-95508-4-p1mMlSrcOO@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95508-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:1bab254fd30c2b94a675b9057349fc80946375b1

commit r10-8315-g1bab254fd30c2b94a675b9057349fc80946375b1
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Jun 17 14:38:05 2020 -0400

    c++: ICE with IMPLICIT_CONV_EXPR in array subscript [PR95508]

    Since r10-7096 convert_like, when called in a template, creates an
    IMPLICIT_CONV_EXPR when we're converting to/from array type.

    In this test, we have e[f], and we're converting f (of type class A) to
    int, so convert_like in build_new_op_1 created the IMPLICIT_CONV_EXPR
    that got into cp_build_array_ref which calls maybe_constant_value.  My
    patch above failed to adjust this spot to call fold_non_dependent_expr
    instead, which can handle codes like I_C_E in a template.  Fixed by
    using a new function maybe_fold_non_dependent_expr, which, if the expr
    can't be evaluated to a constant, returns the original expression.

    gcc/cp/ChangeLog:

            PR c++/95508
            * constexpr.c (maybe_fold_non_dependent_expr): New.
            * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
            * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
            instead of maybe_constant_value.

    gcc/testsuite/ChangeLog:

            PR c++/95508
            * g++.dg/template/conv16.C: New test.

  parent reply	other threads:[~2020-06-17 18:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 16:46 [Bug c++/95508] New: [10/11 " jakub at gcc dot gnu.org
2020-06-03 16:46 ` [Bug c++/95508] " jakub at gcc dot gnu.org
2020-06-03 16:49 ` mpolacek at gcc dot gnu.org
2020-06-16 17:34 ` mpolacek at gcc dot gnu.org
2020-06-17 13:21 ` cvs-commit at gcc dot gnu.org
2020-06-17 13:41 ` [Bug c++/95508] [10 " mpolacek at gcc dot gnu.org
2020-06-17 18:39 ` cvs-commit at gcc dot gnu.org [this message]
2020-06-17 18:39 ` mpolacek at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95508-4-p1mMlSrcOO@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).