public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109385] New: decltype in lambda causes internal compiler error
@ 2023-04-03 6:53 stevenxia990430 at gmail dot com
2023-04-03 6:58 ` [Bug c++/109385] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: stevenxia990430 at gmail dot com @ 2023-04-03 6:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109385
Bug ID: 109385
Summary: decltype in lambda causes internal compiler error
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: stevenxia990430 at gmail dot com
Target Milestone: ---
The following program reports an internal compiler error: Segmentation fault
To quickly reproduce: https://gcc.godbolt.org/z/WPWjs116W
```
#include <vector>
#include <algorithm>
int main() {
auto sort_fn = [](auto... vals) {
return [=]() {
decltype(vals) vec;
}();
};
auto result = sort_fn();
}
```
Removing the decltype(vals) inside the lambda removes the internal compiler
error.
This crash seems to happen after and including gcc 8.1 to gcc 12.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/109385] decltype in lambda causes internal compiler error
2023-04-03 6:53 [Bug c++/109385] New: decltype in lambda causes internal compiler error stevenxia990430 at gmail dot com
@ 2023-04-03 6:58 ` pinskia at gcc dot gnu.org
2023-04-03 7:00 ` pinskia at gcc dot gnu.org
2023-04-03 7:12 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-03 6:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109385
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |c++-lambda,
| |ice-on-invalid-code
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is definitely invalid code as vals has variadic type. that is it needs to
be used inside a fold expressions or with ...
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/109385] decltype in lambda causes internal compiler error
2023-04-03 6:53 [Bug c++/109385] New: decltype in lambda causes internal compiler error stevenxia990430 at gmail dot com
2023-04-03 6:58 ` [Bug c++/109385] " pinskia at gcc dot gnu.org
@ 2023-04-03 7:00 ` pinskia at gcc dot gnu.org
2023-04-03 7:12 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-03 7:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109385
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang rejects it with:
<source>:4:16: error: expression contains unexpanded parameter pack 'vals'
return [=]() {
^
<source>:9:10: error: variable has incomplete type 'void'
auto result = sort_fn();
^
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/109385] decltype in lambda causes internal compiler error
2023-04-03 6:53 [Bug c++/109385] New: decltype in lambda causes internal compiler error stevenxia990430 at gmail dot com
2023-04-03 6:58 ` [Bug c++/109385] " pinskia at gcc dot gnu.org
2023-04-03 7:00 ` pinskia at gcc dot gnu.org
@ 2023-04-03 7:12 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-03 7:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109385
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-04-03
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=100035
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. Related to PR 100035.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-03 7:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-03 6:53 [Bug c++/109385] New: decltype in lambda causes internal compiler error stevenxia990430 at gmail dot com
2023-04-03 6:58 ` [Bug c++/109385] " pinskia at gcc dot gnu.org
2023-04-03 7:00 ` pinskia at gcc dot gnu.org
2023-04-03 7:12 ` 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).