public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114167] New: Capturing a auto..., then unpacking it in a lambda taking Ts..., confuses GCC
@ 2024-02-29 12:43 blubban at gmail dot com
2024-03-27 7:49 ` [Bug c++/114167] " pinskia at gcc dot gnu.org
2024-03-27 7:50 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: blubban at gmail dot com @ 2024-02-29 12:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114167
Bug ID: 114167
Summary: Capturing a auto..., then unpacking it in a lambda
taking Ts..., confuses GCC
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: blubban at gmail dot com
Target Milestone: ---
void a(int, int) {}
template<typename... Ts>
void b()
{
[](auto... ch){
[ch...](Ts... newvals) {
(a(ch, newvals), ...);
}(3,4);
}(1,2);
}
void c()
{
b<int,int>();
}
No flags needed. (Needs -std=c++17, but that's the default.)
Expected: Should compile.
Actual:
<source>: In instantiation of 'a<int, int>()::<lambda(auto:1 ...)> [with auto:1
= {int, int}]':
<source>:8:6: required from 'void a() [with Ts = {int, int}]'
<source>:13:15: required from here
<source>:6:19: error: 'newvals#0' is not captured
6 | ((ch, newvals), ...);
| ^~~~~~~
<source>:5:9: note: the lambda has no capture-default
5 | [ch...](Ts... newvals) {
| ^~~~~~~~~~~~~~~~~~~~~~~~
6 | ((ch, newvals), ...);
| ~~~~~~~~~~~~~~~~~~~~~
7 | }(3,4);
| ~
<source>:5:19: note: 'int newvals#0' declared here
5 | [ch...](Ts... newvals) {
| ~~^~~~~~~~~~~
Compiler returned: 1
I'm not 100% sure if that is valid C++, but Clang accepts it, and the error
message somehow manages to ask to capture newvals before it's declared.
https://godbolt.org/z/G8Kh9rvYc
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/114167] Capturing a auto..., then unpacking it in a lambda taking Ts..., confuses GCC
2024-02-29 12:43 [Bug c++/114167] New: Capturing a auto..., then unpacking it in a lambda taking Ts..., confuses GCC blubban at gmail dot com
@ 2024-03-27 7:49 ` pinskia at gcc dot gnu.org
2024-03-27 7:50 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-27 7:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114167
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andipeer at gmx dot net
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 114495 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/114167] Capturing a auto..., then unpacking it in a lambda taking Ts..., confuses GCC
2024-02-29 12:43 [Bug c++/114167] New: Capturing a auto..., then unpacking it in a lambda taking Ts..., confuses GCC blubban at gmail dot com
2024-03-27 7:49 ` [Bug c++/114167] " pinskia at gcc dot gnu.org
@ 2024-03-27 7:50 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-27 7:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114167
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Keywords| |rejects-valid
Last reconfirmed| |2024-03-27
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-27 7:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-29 12:43 [Bug c++/114167] New: Capturing a auto..., then unpacking it in a lambda taking Ts..., confuses GCC blubban at gmail dot com
2024-03-27 7:49 ` [Bug c++/114167] " pinskia at gcc dot gnu.org
2024-03-27 7:50 ` pinskia at gcc dot gnu.org
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).