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

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
FWIW, the problematic hunk from r12-7714 appears to be:

--- a/gcc/cp/class.cc
+++ b/gcc/cp/class.cc
...
@@ -7700,14 +7723,17 @@ finish_struct (tree t, tree attributes)
         lookup not to fail or recurse into bases.  This isn't added
         to the template decl list so we drop this at instantiation
         time.  */
-      tree ass_op = build_lang_decl (USING_DECL, assign_op_identifier,
-                                    NULL_TREE);
-      DECL_CONTEXT (ass_op) = t;
-      USING_DECL_SCOPE (ass_op) = t;
-      DECL_DEPENDENT_P (ass_op) = true;
-      DECL_ARTIFICIAL (ass_op) = true;
-      DECL_CHAIN (ass_op) = TYPE_FIELDS (t);
-      TYPE_FIELDS (t) = ass_op;
+      if (!get_class_binding_direct (t, assign_op_identifier, false))
+       {
+         tree ass_op = build_lang_decl (USING_DECL, assign_op_identifier,
+                                        NULL_TREE);
+         DECL_CONTEXT (ass_op) = t;
+         USING_DECL_SCOPE (ass_op) = t;
+         DECL_DEPENDENT_P (ass_op) = true;
+         DECL_ARTIFICIAL (ass_op) = true;
+         DECL_CHAIN (ass_op) = TYPE_FIELDS (t);
+         TYPE_FIELDS (t) = ass_op;
+       }

       TYPE_SIZE (t) = bitsize_zero_node;
       TYPE_SIZE_UNIT (t) = size_zero_node;


This hunk causes us to no longer create a dependent USING_DECL representing the
implicitly declared operator= for ServiceReference<T>, which means name lookup
for operator= at parse time yields only the ServiceReferenceBase::operator=
members.  This allows us to prune the overload set for the call 'operator=(0)'
ahead of time and hence we end up calling filter_memfn_lookup later at
instantiation time where we crash due comment #2.

Reply via email to