Hi! As the testcase shows, we weren't diagnosing the foo case in the testcase and would just silently overwrite old DECL_INITIAL with error_mark_node and ICE later on. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2017-12-01 Jakub Jelinek <ja...@redhat.com> PR c++/80259 * decl2.c (grokfield): Diagnose = delete redefinition of a friend. * g++.dg/cpp0x/pr80259.C: New test. --- gcc/cp/decl2.c.jj 2017-11-21 08:43:50.000000000 +0100 +++ gcc/cp/decl2.c 2017-12-01 12:01:32.671514761 +0100 @@ -911,9 +911,18 @@ grokfield (const cp_declarator *declarat { if (init == ridpointers[(int)RID_DELETE]) { - DECL_DELETED_FN (value) = 1; - DECL_DECLARED_INLINE_P (value) = 1; - DECL_INITIAL (value) = error_mark_node; + if (friendp && decl_defined_p (value)) + { + error ("redefinition of %q#D", value); + inform (DECL_SOURCE_LOCATION (value), + "%q#D previously defined here", value); + } + else + { + DECL_DELETED_FN (value) = 1; + DECL_DECLARED_INLINE_P (value) = 1; + DECL_INITIAL (value) = error_mark_node; + } } else if (init == ridpointers[(int)RID_DEFAULT]) { --- gcc/testsuite/g++.dg/cpp0x/pr80259.C.jj 2017-12-01 12:06:54.611405404 +0100 +++ gcc/testsuite/g++.dg/cpp0x/pr80259.C 2017-12-01 12:06:19.000000000 +0100 @@ -0,0 +1,13 @@ +// PR c++/80259 +// { dg-do compile { target c++11 } } + +void foo () {} // { dg-message "previously defined here" } +void bar (); + +struct A +{ + friend void foo () = delete; // { dg-error "redefinition of" } + friend void bar () = delete; // { dg-message "previously defined here" } +}; + +void bar () {} // { dg-error "redefinition of" } Jakub