public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/84469] structured binding inside for all loop thinks it is type depedent when it is not (inside a template)
Date: Fri, 02 Dec 2022 09:34:34 +0000	[thread overview]
Message-ID: <bug-84469-4-AnbT1dqk55@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-84469-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

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

commit r13-4460-gee4f25999f6832a1c5060b9277222c03d852709a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Dec 2 10:29:11 2022 +0100

    c++: Deduce range for structured bindings if expression is not type
dependent [PR84469]

    As shown on the decomp56.C testcase, if the range for expression
    when using structured bindings is not type dependent, we deduce
    the finish the structured binding types only when not in template
    (cp_convert_range_for takes care of that), but if in templates,
    do_range_for_auto_deduction is called instead and it doesn't handle
    structured bindings.  During instantiation they are handled later,
    but during the parsing keeping the structured bindings type
    dependent when they shouldn't be changes behavior.
    The following patch calls cp_finish_decomp even from
    do_range_for_auto_deduction.
    The patch regresses the OpenMP g++.dg/gomp/for-21.C test (3 errors
    are gone), I'll post an incremental patch for it momentarily.

    2022-12-02  Jakub Jelinek  <jakub@redhat.com>

            PR c++/84469
            * parser.cc (do_range_for_auto_deduction): Add DECOMP_FIRST_NAME
            and DECOMP_CNT arguments.  Call cp_finish_decomp if DECL
            is a structured binding.
            (cp_parser_range_for): Adjust do_range_for_auto_deduction caller.
            (cp_convert_omp_range_for): Likewise.

            * g++.dg/cpp1z/decomp56.C: New test.
            * g++.dg/gomp/pr84469.C: New test.

  parent reply	other threads:[~2022-12-02  9:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-84469-4@http.gcc.gnu.org/bugzilla/>
2021-07-22 20:52 ` [Bug c++/84469] GCC rejects valid code in structured binding in range-based-for in template pinskia at gcc dot gnu.org
2021-10-05  5:43 ` pinskia at gcc dot gnu.org
2022-11-24 15:14 ` [Bug c++/84469] structured binding inside for all loop thinks it is type depedent when it is not (inside a template) pinskia at gcc dot gnu.org
2022-11-25 15:16 ` jakub at gcc dot gnu.org
2022-11-28  8:54 ` jakub at gcc dot gnu.org
2022-12-02  9:34 ` cvs-commit at gcc dot gnu.org [this message]
2022-12-02  9:34 ` cvs-commit at gcc dot gnu.org
2022-12-02 10:21 ` jakub at gcc dot gnu.org

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-84469-4-AnbT1dqk55@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).