[Bug c++/89241] [9 Regression] ICE in enclosing_instantiation_of, at cp/pt.c:13380

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 27 18:39:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89241

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Mar 27 18:39:20 2019
New Revision: 269972

URL: https://gcc.gnu.org/viewcvs?rev=269972&root=gcc&view=rev
Log:
        PR c++/89241 - ICE with lambda in template parameter list.

We were getting confused by a lambda in template definition context that
isn't actually in the scope of any templated entity.  Fixed by telling
type_dependent_expression_p that such a lambda is type-dependent even if we
can't tell that from its closure type.  I've also restored the error for
defining a non-lambda class in a default template argument, and for a lambda
befor C++20.

        * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
        template parameter list before C++20.
        * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
        * semantics.c (begin_class_definition): Restore error about defining
        non-lambda class in template parm list.

Added:
    trunk/gcc/testsuite/g++.dg/cpp2a/lambda-uneval10.C
    trunk/gcc/testsuite/g++.dg/ext/complit16.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/semantics.c


More information about the Gcc-bugs mailing list