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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>:

https://gcc.gnu.org/g:82c2acd0bc4411524a8248fcdce219927d921a71

commit r15-3694-g82c2acd0bc4411524a8248fcdce219927d921a71
Author: Patrick Palka <ppa...@redhat.com>
Date:   Wed Sep 18 13:50:43 2024 -0400

    c++: alias of decltype(lambda) is opaque [PR116714, PR107390]

    Here for

      using type = decltype([]{});
      static_assert(is_same_v<type, type>);

    we strip the alias ahead of time during template argument coercion
    which effectively transforms the template-id into

      is_same_v<decltype([]{}), decltype([]{})>

    which is wrong because later substitution into the template-id will
    produce two new lambdas with distinct types and cause is_same_v to
    return false.

    This demonstrates that such aliases should be considered opaque (a
    notion that we recently introduced in r15-2331-g523836716137d0).
    (An alternative solution might be to consider memoizing lambda-expr
    substitution rather than always producing a new lambda, but this is
    much simpler.)

            PR c++/116714
            PR c++/107390

    gcc/cp/ChangeLog:

            * pt.cc (dependent_opaque_alias_p): Also return true for a
            decltype(lambda) alias.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/lambda-uneval18.C: New test.

    Reviewed-by: Jason Merrill <ja...@redhat.com>

Reply via email to