c++: dependent generic lambda template-id [PR106024]
authorJason Merrill <jason@redhat.com>
Fri, 24 Jun 2022 03:14:35 +0000 (23:14 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 1 Jul 2022 14:51:42 +0000 (10:51 -0400)
commitc17206709f94331e81443e2bdcf135a6ab7428ce
tree83f01e5e8509de6586b45170b4c9753e7671690f
parent8d8af1480b32495c82661c7864e8978a53529c1d
c++: dependent generic lambda template-id [PR106024]

We were wrongly looking up the generic lambda op() in a dependent scope, and
then trying to look up its instantiation at substitution time, but lambdas
aren't instantiated, so we crashed.  The fix is to not look into dependent
class scopes.

But this created trouble with wrongly trying to use a template from the
enclosing scope when we aren't actually looking at a template-argument-list,
in template/lookup18.C, so let's avoid that.

PR c++/106024

gcc/cp/ChangeLog:

* parser.cc (missing_template_diag): Factor out...
(cp_parser_id_expression): ...from here.
(cp_parser_lookup_name): Don't look in dependent object_type.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/lambda-generic10.C: New test.
gcc/cp/parser.cc
gcc/testsuite/g++.dg/cpp2a/lambda-generic10.C [new file with mode: 0644]