Commit 91c95da8 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/80259 (ICE deleting friend function)

	PR c++/80259
	* decl2.c (grokfield): Diagnose = delete redefinition of a friend.

	* g++.dg/cpp0x/pr80259.C: New test.

From-SVN: r255456
parent c25ac927
2017-12-06 Jakub Jelinek <jakub@redhat.com>
PR c++/80259
* decl2.c (grokfield): Diagnose = delete redefinition of a friend.
2017-12-06 Jason Merrill <jason@redhat.com> 2017-12-06 Jason Merrill <jason@redhat.com>
* call.c (convert_for_arg_passing): Pass NULL_TREE to * call.c (convert_for_arg_passing): Pass NULL_TREE to
......
...@@ -911,9 +911,18 @@ grokfield (const cp_declarator *declarator, ...@@ -911,9 +911,18 @@ grokfield (const cp_declarator *declarator,
{ {
if (init == ridpointers[(int)RID_DELETE]) if (init == ridpointers[(int)RID_DELETE])
{ {
DECL_DELETED_FN (value) = 1; if (friendp && decl_defined_p (value))
DECL_DECLARED_INLINE_P (value) = 1; {
DECL_INITIAL (value) = error_mark_node; 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]) else if (init == ridpointers[(int)RID_DEFAULT])
{ {
......
2017-12-06 Jakub Jelinek <jakub@redhat.com>
PR c++/80259
* g++.dg/cpp0x/pr80259.C: New test.
2017-12-06 David Malcolm <dmalcolm@redhat.com> 2017-12-06 David Malcolm <dmalcolm@redhat.com>
PR c/83236 PR c/83236
......
// 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" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment