public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109017] New: ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax
@ 2023-03-03 20:51 arthur.j.odwyer at gmail dot com
2023-03-04 16:22 ` [Bug c++/109017] " hiraditya at msn dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2023-03-03 20:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109017
Bug ID: 109017
Summary: ICE on unexpanded pack from C++20
explicit-template-parameter lambda syntax
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: arthur.j.odwyer at gmail dot com
Target Milestone: ---
// https://godbolt.org/z/bdT84P318
template<class...>
struct A {
static void g() {
int dummy[] = {
[]<class... Ts>(Ts... ts){
int i = Ts();
} ...
};
}
};
int main() {
A<int>::g();
}
<source>: In instantiation of 'static void A< <template-parameter-1-1> >::g()
[with <template-parameter-1-1> = {int}]':
<source>:12:14: required from here
<source>:4:13: internal compiler error: in tsubst_pack_expansion, at
cp/pt.cc:13388
4 | int dummy[] = {
| ^~~~~
0x247a53e internal_error(char const*, ...)
???:0
0xae95dc fancy_abort(char const*, int, char const*)
???:0
0xd09f45 instantiate_decl(tree_node*, bool, bool)
???:0
0xd362db instantiate_pending_templates(int)
???:0
0xbe4555 c_parse_final_cleanups()
???:0
0xe21948 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
Apparently GCC fails to recognize the `class... Ts` in the angle brackets (new
syntax in C++20) as pertaining to the lambda itself, and not to the outer
scope. So when GCC sees an unexpanded `Ts` in the inner scope, GCC happily
accepts it (and then ICEs). Notice that if you change `Ts()` to `ts` in the
inner scope, GCC correctly rejects the code with the usual "parameter packs not
expanded" error. The ICE is triggered specifically by misuse of
`Ts`-from-the-new-in-C++20-syntax.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/109017] ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax
2023-03-03 20:51 [Bug c++/109017] New: ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax arthur.j.odwyer at gmail dot com
@ 2023-03-04 16:22 ` hiraditya at msn dot com
2023-03-06 8:28 ` rguenth at gcc dot gnu.org
2023-03-07 14:53 ` [Bug c++/109017] ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax since r8-7648-g8859913ea3cbefdc marxin at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: hiraditya at msn dot com @ 2023-03-04 16:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109017
AK <hiraditya at msn dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hiraditya at msn dot com
--- Comment #1 from AK <hiraditya at msn dot com> ---
Example from twitter: https://twitter.com/seanbax/status/1631689332007337985
which had discussion on similar bug.
```
template<int... Is> struct outer1_t {
void g() {
// Compiles for mysterious reasons.
int array[] { []<int... Is2>(){
int i = Is2;
return i;
}.template operator()<Is>() ... };
}
};
int main() {
// Compiles OKAY when this is commented out.
// ICEs when it's compiled.
outer1_t<1, 5, 10>().g();
}
```
clang issues a compiler error: https://godbolt.org/z/7f6E55svM
```
<source>:6:15: error: initializer contains unexpanded parameter pack 'Is2'
int i = Is2;
```
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/109017] ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax
2023-03-03 20:51 [Bug c++/109017] New: ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax arthur.j.odwyer at gmail dot com
2023-03-04 16:22 ` [Bug c++/109017] " hiraditya at msn dot com
@ 2023-03-06 8:28 ` rguenth at gcc dot gnu.org
2023-03-07 14:53 ` [Bug c++/109017] ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax since r8-7648-g8859913ea3cbefdc marxin at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-06 8:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109017
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-03-06
Known to fail| |10.4.1, 12.2.1, 13.0
Status|UNCONFIRMED |NEW
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/109017] ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax since r8-7648-g8859913ea3cbefdc
2023-03-03 20:51 [Bug c++/109017] New: ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax arthur.j.odwyer at gmail dot com
2023-03-04 16:22 ` [Bug c++/109017] " hiraditya at msn dot com
2023-03-06 8:28 ` rguenth at gcc dot gnu.org
@ 2023-03-07 14:53 ` marxin at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-03-07 14:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109017
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ICE on unexpanded pack from |ICE on unexpanded pack from
|C++20 |C++20
|explicit-template-parameter |explicit-template-parameter
|lambda syntax |lambda syntax since
| |r8-7648-g8859913ea3cbefdc
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r8-7648-g8859913ea3cbefdc.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-07 14:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 20:51 [Bug c++/109017] New: ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax arthur.j.odwyer at gmail dot com
2023-03-04 16:22 ` [Bug c++/109017] " hiraditya at msn dot com
2023-03-06 8:28 ` rguenth at gcc dot gnu.org
2023-03-07 14:53 ` [Bug c++/109017] ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax since r8-7648-g8859913ea3cbefdc marxin 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).