@@ -10173,7 +10173,8 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
= tree_cons (arglist, t,
DECL_TEMPLATE_INSTANTIATIONS (found));
- if (TREE_CODE (template_type) == ENUMERAL_TYPE && !is_dependent_type
+ if (TREE_CODE (template_type) == ENUMERAL_TYPE
+ && !uses_template_parms (current_nonlambda_scope ())
&& !DECL_ALIAS_TEMPLATE_P (gen_tmpl))
/* Now that the type has been registered on the instantiations
list, we set up the enumerators. Because the enumeration
new file mode 100644
@@ -0,0 +1,10 @@
+// PR c++/95317
+// { dg-do compile { target c++14 } }
+
+template <typename> void fn1() {
+ [](auto) {
+ enum { VALUE };
+ VALUE;
+ };
+}
+int main() { fn1<void>; }