public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/103901] A lambda with a new type in its body cannot be defined inside template parameter list
Date: Tue, 04 Jan 2022 20:15:30 +0000	[thread overview]
Message-ID: <bug-103901-4-q22MQA0N9h@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103901-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If it is valid, I think e.g.
--- gcc/cp/parser.c.jj  2022-01-04 09:59:37.297641779 +0100
+++ gcc/cp/parser.c     2022-01-04 20:56:19.065070397 +0100
@@ -11046,6 +11046,9 @@ cp_parser_lambda_expression (cp_parser*
     bool save_in_consteval_if_p = in_consteval_if_p;
     in_consteval_if_p = false;

+    int saved_processing_template_parmlist = processing_template_parmlist;
+    processing_template_parmlist = 0;
+
     /* By virtue of defining a local class, a lambda expression has access to
        the private variables of enclosing classes.  */

@@ -11078,6 +11081,7 @@ cp_parser_lambda_expression (cp_parser*

     in_consteval_if_p = save_in_consteval_if_p;
     in_discarded_stmt = discarded;
+    processing_template_parmlist = saved_processing_template_parmlist;

     parser->num_template_parameter_lists = saved_num_template_parameter_lists;
     parser->in_statement = in_statement;
should fix that.  But as the stack-overflow link says, it is unclear.
Also, we still reject even with the above patch
decltype ([]{ struct A {} ; return 1; }) a;
(guess that is PR101911).

      parent reply	other threads:[~2022-01-04 20:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04  8:35 [Bug c++/103901] New: " fchelnokov at gmail dot com
2022-01-04 18:37 ` [Bug c++/103901] " pinskia at gcc dot gnu.org
2022-01-04 18:38 ` pinskia at gcc dot gnu.org
2022-01-04 20:15 ` jakub at gcc dot gnu.org [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103901-4-q22MQA0N9h@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).