PR c++/89241 - ICE with __func__ in lambda in template.
When we're instantiating a generic lambda, its enclosing context will have already been instantiated, so we need to look for that as well. * pt.c (enclosing_instantiation_of): Also check instantiated_lambda_fn_p for the template context. From-SVN: r268784
This commit is contained in:
parent
ab97c3cdaf
commit
0df9962aa8
3 changed files with 20 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2019-02-11 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/89241 - ICE with __func__ in lambda in template.
|
||||
* pt.c (enclosing_instantiation_of): Also check
|
||||
instantiated_lambda_fn_p for the template context.
|
||||
|
||||
2019-02-11 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
|
||||
|
|
|
@ -13355,7 +13355,8 @@ enclosing_instantiation_of (tree otctx)
|
|||
tree fn = current_function_decl;
|
||||
int lambda_count = 0;
|
||||
|
||||
for (; tctx && lambda_fn_in_template_p (tctx);
|
||||
for (; tctx && (lambda_fn_in_template_p (tctx)
|
||||
|| instantiated_lambda_fn_p (tctx));
|
||||
tctx = decl_function_context (tctx))
|
||||
++lambda_count;
|
||||
for (; fn; fn = decl_function_context (fn))
|
||||
|
|
12
gcc/testsuite/g++.dg/cpp1y/lambda-generic-func1.C
Normal file
12
gcc/testsuite/g++.dg/cpp1y/lambda-generic-func1.C
Normal file
|
@ -0,0 +1,12 @@
|
|||
// PR c++/89241
|
||||
// { dg-do compile { target c++14 } }
|
||||
|
||||
template <typename al> void m(al p) {
|
||||
p(1);
|
||||
}
|
||||
|
||||
template <typename ax> void f() {
|
||||
m([](auto) { __func__; });
|
||||
}
|
||||
|
||||
template void f<int>();
|
Loading…
Add table
Reference in a new issue