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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/cp/search.cc.jj 2026-03-13 09:07:06.373863631 +0100
+++ gcc/cp/search.cc    2026-03-23 13:55:44.388390861 +0100
@@ -814,7 +814,8 @@ friend_accessible_p (tree scope, tree de
     }

   /* If is_friend is true, we should have found a befriending class.  */
-  gcc_checking_assert (!is_friend (type, scope));
+  gcc_checking_assert (!is_friend (type, scope)
+                      || TYPE_P (scope) && same_type_p (type, scope));

   return 0;
 }
the testcase is rejected because is_accessible is false.
But given that with s/union { int b; };/int b;/ it is accepted, clearly that is
wrong.

Reply via email to