build_m_component_ref can't handle type-dependent operands, so let's use the
default case; tsubst_copy_and_build also uses build_x_binary_op for
substituting a DOTSTAR_EXPR.

Tested x86_64-pc-linux-gnu, applying to trunk.

        * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
---
 gcc/cp/pt.c      | 2 --
 gcc/cp/ChangeLog | 3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d678e278078..7295839ebd2 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11784,8 +11784,6 @@ fold_expression (tree t, tree left, tree right, 
tsubst_flags_t complain)
     {
     case COMPOUND_EXPR:
       return build_x_compound_expr (input_location, left, right, complain);
-    case DOTSTAR_EXPR:
-      return build_m_component_ref (left, right, complain);
     default:
       return build_x_binary_op (input_location, code,
                                 left, TREE_CODE (left),
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 30cc1ce46b3..a86ffa3c33b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
 2019-02-28  Jason Merrill  <ja...@redhat.com>
 
+       PR c++/88183 - ICE with .* fold-expression.
+       * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
+
        PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
        * class.c, lambda.c, pt.c: Revert earlier change.
        * lambda.c (add_capture): Don't special-case capture of dependent

base-commit: 9b4cf3ba9e18c87adde90f3a7c7e1b770714a754
-- 
2.20.1

Reply via email to