Bug 102693 - ICE in tsubst related to lambdas as template default parameters
Summary: ICE in tsubst related to lambdas as template default parameters
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 9.4.0
: P3 normal
Target Milestone: 14.0
Assignee: Not yet assigned to anyone
URL:
Keywords: c++-lambda, ice-on-valid-code
Depends on:
Blocks: lambdas
  Show dependency treegraph
 
Reported: 2021-10-11 21:49 UTC by hq.ks
Modified: 2024-04-15 22:23 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
reproducer (240 bytes, text/plain)
2021-10-11 21:49 UTC, hq.ks
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hq.ks 2021-10-11 21:49:03 UTC
Created attachment 51589 [details]
reproducer

Possible a duplicate of 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98500

but without template templates. 

> g++ -Wall -Wextra -std=gnu++2a -c template_def.cxx 
template_def.cxx: In instantiation of ‘int bar() [with bool b = true]’:
template_def.cxx:24:4:   required from here
template_def.cxx:2:18: internal compiler error: in tsubst, at cp/pt.c:14666
    2 | template <auto f=[](){} > // works fine if rhs is not a lambda expression
      |                  ^~~~~~
0x58c6c9 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../.././gcc/cp/pt.c:14666
0x6d8985 tsubst_function_type
        ../.././gcc/cp/pt.c:14270
0x6c9ca4 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../.././gcc/cp/pt.c:15110
0x6d96d5 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ../.././gcc/cp/pt.c:18376
0x6cdf03 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
        ../.././gcc/cp/pt.c:19820
0x6c0d1c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../.././gcc/cp/pt.c:18131
0x6d1dc2 tsubst_template_args
        ../.././gcc/cp/pt.c:12670
0x6d6648 tsubst_aggr_type
        ../.././gcc/cp/pt.c:12867
0x6c9eff tsubst(tree_node*, tree_node*, int, tree_node*)
        ../.././gcc/cp/pt.c:14565
0x6d3de3 tsubst_decl
        ../.././gcc/cp/pt.c:13947
0x6ca127 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../.././gcc/cp/pt.c:14483
0x6c2ac0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../.././gcc/cp/pt.c:17307
0x6c14df tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../.././gcc/cp/pt.c:17222
0x6c1e01 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../.././gcc/cp/pt.c:17535
0x6c4d3d tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../.././gcc/cp/pt.c:17207
0x6c4d3d instantiate_decl(tree_node*, bool, bool)
        ../.././gcc/cp/pt.c:25053
0x6df923 instantiate_pending_templates(int)
        ../.././gcc/cp/pt.c:25169
0x638628 c_parse_final_cleanups()
        ../.././gcc/cp/decl2.c:4818
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
 > g++ --version
g++ (GCC) 9.4.0
> uname -a
Linux ... 4.9.0-15-amd64 #1 SMP Debian 4.9.258-1 (2021-03-08) x86_64 GNU/Linux
Comment 1 hq.ks 2021-10-11 21:50:40 UTC
Reproducer should say "if bar is not a template function" in the comment.
Comment 2 Drea Pinski 2023-05-26 06:57:22 UTC
*** Bug 109978 has been marked as a duplicate of this bug. ***
Comment 3 Drea Pinski 2024-04-15 22:22:53 UTC
Fixed on the trunk for GCC 14 by the recent lambda template patches.