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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:ff24ef677edee888012aaddeb0ec9bbe366b4f57

commit r10-9845-gff24ef677edee888012aaddeb0ec9bbe366b4f57
Author: Jason Merrill <ja...@redhat.com>
Date:   Mon Apr 5 11:34:48 2021 -0400

    c++: lambda in DMI in class template [PR95870]

    Here enclosing_instantiation_of was failing to find a match because otctx
is
    struct S<T> and current_function_decl is S<int>::S(), so the latter has
more
    function contexts, and we end up trying to compare S() to NULL_TREE.

    After spending a bit of time working on establishing the correspondence in
    this case (class <=> constructor), it occurred to me that we could just use
    DECL_SOURCE_LOCATION, which is unique for lambdas, since they cannot be
    redeclared.  Since we're so close to release, for now I'm only doing this
    for the case that was failing before.

    gcc/cp/ChangeLog:

            PR c++/95870
            * pt.c (enclosing_instantiation_of): Compare DECL_SOURCE_LOCATION
if
            there is no enclosing non-lambda function.

    gcc/testsuite/ChangeLog:

            PR c++/95870
            * g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test.

Reply via email to