[gcc(refs/vendors/redhat/heads/gcc-9-branch)] c++: Fix constexpr ICE from const mismatch [PR91607]

Jakub Jelinek jakub@gcc.gnu.org
Tue Mar 17 19:20:25 GMT 2020


https://gcc.gnu.org/g:e19f06538c51fed54240a4e98277e62daa00d9b3

commit e19f06538c51fed54240a4e98277e62daa00d9b3
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Mar 4 23:07:13 2020 -0500

    c++: Fix constexpr ICE from const mismatch [PR91607]
    
    gcc/cp/ChangeLog
    2020-03-04  Jason Merrill  <jason@redhat.com>
    
            PR c++/91607
            * constexpr.c (constexpr_call_hasher::equal): Use
            same_type_ignoring_top_level_qualifiers_p.

Diff:
---
 gcc/cp/ChangeLog   | 6 ++++++
 gcc/cp/constexpr.c | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3f4c1b1f6a3..6c4a7751662 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-04  Jason Merrill  <jason@redhat.com>
+
+	PR c++/91607
+	* constexpr.c (constexpr_call_hasher::equal): Use
+	same_type_ignoring_top_level_qualifiers_p.
+
 2020-03-04  Martin Sebor  <msebor@redhat.com>
 
 	PR c++/90938
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index b9b387ca7e9..bab5935a4eb 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1088,7 +1088,8 @@ constexpr_call_hasher::equal (constexpr_call *lhs, constexpr_call *rhs)
     {
       tree lhs_arg = TREE_VALUE (lhs_bindings);
       tree rhs_arg = TREE_VALUE (rhs_bindings);
-      gcc_assert (same_type_p (TREE_TYPE (lhs_arg), TREE_TYPE (rhs_arg)));
+      gcc_assert (same_type_ignoring_top_level_qualifiers_p
+		  (TREE_TYPE (lhs_arg), TREE_TYPE (rhs_arg)));
       if (!cp_tree_equal (lhs_arg, rhs_arg))
         return false;
       lhs_bindings = TREE_CHAIN (lhs_bindings);


More information about the Gcc-cvs mailing list