Commit a6e34898 by Paolo Carlini Committed by Paolo Carlini

re PR c++/84691 (internal compiler error: in poplevel_class, at cp/name-lookup.c:4430)

/cp
2018-04-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84691
	* decl.c (grokdeclarator): Clear friendp upon definition in local
	class definition error.

/testsuite
2018-04-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84691
	* g++.dg/cpp0x/friend3.C: New.

From-SVN: r259716
parent 6d0e87b2
2018-04-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84691
* decl.c (grokdeclarator): Clear friendp upon definition in local
class definition error.
2018-04-27 Jason Merrill <jason@redhat.com> 2018-04-27 Jason Merrill <jason@redhat.com>
PR c++/85545 - ICE with noexcept PMF conversion. PR c++/85545 - ICE with noexcept PMF conversion.
......
...@@ -11298,9 +11298,11 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -11298,9 +11298,11 @@ grokdeclarator (const cp_declarator *declarator,
if (decl_context == NORMAL) if (decl_context == NORMAL)
error ("friend declaration not in class definition"); error ("friend declaration not in class definition");
if (current_function_decl && funcdef_flag) if (current_function_decl && funcdef_flag)
error ("can%'t define friend function %qs in a local " {
"class definition", error ("can%'t define friend function %qs in a local "
name); "class definition", name);
friendp = 0;
}
} }
else if (ctype && sfk == sfk_conversion) else if (ctype && sfk == sfk_conversion)
{ {
......
2018-04-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84691
* g++.dg/cpp0x/friend3.C: New.
2018-04-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2018-04-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/82518 PR target/82518
......
// PR c++/84691
// { dg-do compile { target c++11 } }
template<typename>
struct a {
unsigned b = [] {
union {
friend void c() {} // { dg-error "local class" }
}; // { dg-error "no members" }
};
};
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