[Bug c++/105398] [11/12 Regression][ICE] enum in array in lambda
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 27 17:09:22 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105398
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:409edcca331296b53842c50d3b789e1b1ccc05e5
commit r12-8290-g409edcca331296b53842c50d3b789e1b1ccc05e5
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Apr 26 16:12:58 2022 -0400
c++: enum in generic lambda at global scope [PR105398]
We crash compiling this test since r11-7993 which changed
lookup_template_class_1 so that we only call tsubst_enum when
!uses_template_parms (current_nonlambda_scope ())
But here current_nonlambda_scope () is the global NAMESPACE_DECL ::, which
doesn't have a type, therefore is considered type-dependent. So we don't
call tsubst_enum, and crash in tsubst_copy/CONST_DECL because we didn't
find the e1 enumerator.
I don't think any namespace can depend on any template parameter, so
this patch tweaks uses_template_parms.
PR c++/105398
gcc/cp/ChangeLog:
* pt.cc (uses_template_parms): Return false for any NAMESPACE_DECL.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1y/lambda-generic-enum2.C: New test.
More information about the Gcc-bugs
mailing list