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.c (uses_template_parms): Return false for any NAMESPACE_DECL.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1y/lambda-generic-enum2.C: New test.
(cherry picked from commit
409edcca331296b53842c50d3b789e1b1ccc05e5)