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++/109756] "internal compiler error: tree check" when using the [[assume]] attribute with pack expansion
Date: Tue, 09 May 2023 14:07:36 +0000	[thread overview]
Message-ID: <bug-109756-4-LyCCKFqSvt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109756-4@http.gcc.gnu.org/bugzilla/>

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

--- 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:2499540e9abb55079b5f7b7ccdac97fbc63d9ab4

commit r14-619-g2499540e9abb55079b5f7b7ccdac97fbc63d9ab4
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue May 9 16:05:22 2023 +0200

    c++: Reject pack expansion of assume attribute [PR109756]

    http://eel.is/c++draft/dcl.attr#grammar-4 says
    "In an attribute-list, an ellipsis may appear only if that attribute's
    specification permits it."
    and doesn't explicitly permit it on any standard attribute.
    The https://wg21.link/p1774r8 paper which introduced assume attribute says
    "We could therefore hypothetically permit the assume attribute to directly
    support pack expansion:
    template <int... args>
    void f() {
    [[assume(args >= 0)...]];
    }
    However, we do not propose this. It would require substantial additional
work
    for a very rare use case. Note that this can instead be expressed with a
fold
    expression, which is equivalent to the above and works out of the box
without
    any extra effort:
    template <int... args>
    void f() {
    [[assume(((args >= 0) && ...))]];
    }
    ", but as the testcase shows, GCC 13+ ICEs on assume attribute followed by
    ... if it contains packs.
    The following patch rejects those instead of ICE and for C++17 or later
    suggests using fold expressions instead (it doesn't make sense to suggest
    it for C++14 and earlier when we'd error on the fold expressions).

    2023-05-09  Jakub Jelinek  <jakub@redhat.com>

            PR c++/109756
            * cp-gimplify.cc (process_stmt_assume_attribute): Diagnose pack
            expansion of assume attribute.

            * g++.dg/cpp23/attr-assume11.C: New test.

  parent reply	other threads:[~2023-05-09 14:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-06 10:33 [Bug c++/109756] New: " ensadc at mailnesia dot com
2023-05-06 16:40 ` [Bug c++/109756] " pinskia at gcc dot gnu.org
2023-05-06 16:54 ` jakub at gcc dot gnu.org
2023-05-06 16:59 ` pinskia at gcc dot gnu.org
2023-05-06 17:00 ` pinskia at gcc dot gnu.org
2023-05-07 19:02 ` jakub at gcc dot gnu.org
2023-05-08 10:56 ` jakub at gcc dot gnu.org
2023-05-08 11:26 ` jakub at gcc dot gnu.org
2023-05-09 14:07 ` cvs-commit at gcc dot gnu.org [this message]
2023-05-09 14:10 ` cvs-commit at gcc dot gnu.org
2023-05-10  9:41 ` cvs-commit 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-109756-4-LyCCKFqSvt@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).