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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I suggest:

--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -2068,12 +2068,12 @@ build_m_component_ref (tree datum, tree component,
tsubst_flags_t complain)
   tree binfo;
   tree ctype;

-  if (error_operand_p (datum) || error_operand_p (component))
-    return error_mark_node;
-
   datum = mark_lvalue_use (datum);
   component = mark_rvalue_use (component);

+  if (error_operand_p (datum) || error_operand_p (component))
+    return error_mark_node;
+
   ptrmem_type = TREE_TYPE (component);
   if (!TYPE_PTRMEM_P (ptrmem_type))
     {

because mark_[lr]value_use can cope with error_mark_node.

Reply via email to