c++: Detect unexpandable packs based on scope #213
No reviewers
Labels
No labels
Compat/Breaking
Frontend/ada
Frontend/c
Frontend/c++
Frontend/rust
General/forge
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Library/libgcc
Library/libstdc++
Midend/gimple
Midend/rtl
Midend/tree
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
Target/aarch64
Target/arm
Target/i386
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gcc/gcc!213
Loading…
Reference in a new issue
No description provided.
Delete branch "feedable/gcc-TEST:pr126124"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This patch rewrites old unexpandable pack detection logic based on
current lambda to a one based on scopes.
The new logic tries to answer the following question: "Will the soonest
potential pack expansion have a pack that is declared within its own
pattern?". There aren't a lot of scopes over which we can directly
expand (only lambda and stmt-expr). We can take advantage of that and
assert that any expansion that hasn't occured yet must occur beyond that
scope, so any pack that's declared within that scope, cannot be expanded
over, as it would be within the pattern itself.
For example:
struct X { int x,y,z; };
template<class ...T>
void foo() {
([]{auto [...xs] = X{}; xs + T{};}, ...);
}
When
check_for_bare_parameter_packsis called for the expr-stmtxs + T{};, any possible expansion over that pack will contain thelambda-scope, and as
xsis declared within that scope, it will also becontained within the pattern of that expansion, while
Tis declaredoutside of that scope, so there are expansions which can expand it
without containing its declaration within the pattern.
Also, do actually check for bare parameter packs in the final statement
of a stmt-expr.
gcc/cp/ChangeLog:
gcc/testsuite/ChangeLog:
Changes since v1:
constexprfrom the variable for the lambda infilter_packs.Changes since v2:
finish_stmt_expr_expr.filter_packs.CC: jason@redhat.com
Hi @feedable. This bot helps send your PR as a patch series to the mailing list.
Next steps
CC: Reviewer1 <revi.ewer@example.com>, Reviewer2 <an.other@example.com>./preview./submit.Changes since vXsection, and comment with/submitagain.See Submitting Patches and UsingForge.
Consider joining the gcc and gcc-patches mailing lists..
For real time communication, check the gcc irc channels.
Or join
#overseerson Libera Chat, particularly if this automation is not working (stay online to get replies, IRC does not save messages if people are not online).cdd9210f98921687aa8a/preview
Sent patch version 1 as a single email to @feedable's email address.
Message ID is
<bmm.hl5olwsvrg.gcc.gcc.feedable.213.1.0@forge-stage.sourceware.org>.921687aa8a86e7fd6fbf/submit
Version 1 of this pull request has been stored. It includes the following commits:
86e7fd6fbfSent patch version 1 as a single email to gcc-patches mailing list gcc-patches@gcc.gnu.org.
Cover letter
86e7fd6fbf66cadb90dd/submit
Version 2 of this pull request has been stored. It includes the following commits:
66cadb90ddSent patch version 2 as a single email to gcc-patches mailing list gcc-patches@gcc.gnu.org and cc'd jason@redhat.com.
Cover letter
66cadb90dd56c40064a0/submit
Version 3 of this pull request has been stored. It includes the following commits:
56c40064a0Pull Request versions:
31f66a843486e7fd6fbf2791799fe166cadb90dd8a312e7a4456c40064a0In order to compare , clone this repository and run
Sent patch version 3 as a single email to gcc-patches mailing list gcc-patches@gcc.gnu.org and cc'd jason@redhat.com.
Cover letter
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.