[Bug c++/91847] New: init-capture pack of references requires ... on wrong side
barry.revzin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Sep 20 23:26:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91847
Bug ID: 91847
Summary: init-capture pack of references requires ... on wrong
side
Product: gcc
Version: 9.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
gcc implements the letter of the standard and allows this:
template <typename... T>
void foo(T&... ts) {
[...&us=ts]{};
}
While that is valid per the latest working draft, and is the wording specified
in P0780R2, the direction we really want to go in is to put the ... on the
other side of the &. That is, the declaration of 'us' should look the same as
the declaration of 'ts'. This is CWG 2378.
In other words, the correct syntax should be:
template <typename... T>
void foo(T&... ts) {
[&...us=ts]{};
}
clang implements the CWG 2378 rule, this issue should hopefully be resolved by
the time C++20 ships.
More information about the Gcc-bugs
mailing list