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

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).