]> gcc.gnu.org Git - gcc.git/commit
c++: generic lambda in template fn with DMI [PR100054]
authorJason Merrill <jason@redhat.com>
Tue, 13 Apr 2021 16:33:39 +0000 (12:33 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 13 Apr 2021 18:01:50 +0000 (14:01 -0400)
commit6173f713a35d5450f0e2acfdaec695b42632aeed
tree90af3adbe4a61b4d75c826c2f170ca4d028cb442
parent474cb5a0a404c5de7c1cd21aac8b1b7e7ce95d9b
c++: generic lambda in template fn with DMI [PR100054]

get_nsdmi instantiates default member initializers on demand.  It tries to
push into the context of the class before doing so, so access checking works
properly, but since my patch for 90479 not for local classes.  We should
only be doing this when any template parameters have arguments.  But in this
case, we get here while regenerating a generic lambda, so
processing_template_decl is true, even though the class and its DMI are
non-dependent at this point.  And so we crashed.  So let's do more of the
pushing into the context of the class even for local classes.

gcc/cp/ChangeLog:

PR c++/100054
PR c++/90479
* init.c (get_nsdmi): Do more context adjustment for local classes.

gcc/testsuite/ChangeLog:

PR c++/100054
* g++.dg/cpp1y/lambda-generic-local-class1.C: New test.
gcc/cp/init.c
gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class1.C [new file with mode: 0644]
This page took 0.05724 seconds and 5 git commands to generate.