Commit 5d011fcf by Nathan Sidwell Committed by Nathan Sidwell

[PR c++/84804] ICE with default arg, template friend & lambda

https://gcc.gnu.org/ml/gcc-patches/2018-03/msg01108.html
	PR c++/84804
	* name-lookup.c (do_pushtag): Permit lambdas to be pushed into
	complete classes.


	PR c++/84804
	* g++.dg/lookup/pr84804.C: New.

From-SVN: r258722
parent 00821ad4
2018-03-21 Nathan Sidwell <nathan@acm.org>
PR c++/84804
* name-lookup.c (do_pushtag): Permit lambdas to be pushed into
complete classes.
2018-03-21 Martin Sebor <msebor@redhat.com> 2018-03-21 Martin Sebor <msebor@redhat.com>
PR c++/84850 PR c++/84850
......
...@@ -6436,7 +6436,8 @@ do_pushtag (tree name, tree type, tag_scope scope) ...@@ -6436,7 +6436,8 @@ do_pushtag (tree name, tree type, tag_scope scope)
if (b->kind == sk_class) if (b->kind == sk_class)
{ {
if (!TYPE_BEING_DEFINED (current_class_type)) if (!TYPE_BEING_DEFINED (current_class_type)
&& !LAMBDA_TYPE_P (type))
return error_mark_node; return error_mark_node;
if (!PROCESSING_REAL_TEMPLATE_DECL_P ()) if (!PROCESSING_REAL_TEMPLATE_DECL_P ())
......
2018-03-21 Nathan Sidwell <nathan@acm.org>
PR c++/84804
* g++.dg/lookup/pr84804.C: New.
2018-03-21 Martin Sebor <msebor@redhat.com> 2018-03-21 Martin Sebor <msebor@redhat.com>
PR c++/84850 PR c++/84850
......
// { dg-do compile { target c++11 } }
// PR c++/84804 ICE instantiating friend with default arg containing a lambda
template<int> struct A
{
// Note, instantiation injects this into ::, so there can only be one!
friend void foo(int i = []{ return 0;}()) {}
};
void bar()
{
A<0> x;
}
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