https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96960
Bug ID: 96960
Summary: ICE in tsubst_copy_and_build, at cp/pt.c:20531 from
lambda in return-type-requirement
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hstong at ca dot ibm.com
Target Milestone: ---
The following program ICEs with GCC.
The ICE appears to related to the lambda expression in the
return-type-requirement
### SOURCE (<stdin>):
template <typename, typename> concept C0 = true;
template <typename T>
concept C =
requires(T t) {
{ 42 } -> C0<char [([] { return 42; }())]>;
};
static_assert(C<int>);
### COMPILER INVOCATION:
g++ -fsyntax-only -std=c++20 -xc++ -
### ACTUAL OUTPUT:
<stdin>:6:23: internal compiler error: in tsubst_copy_and_build, at
cp/pt.c:20531
0x5c9d7a tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../source/gcc/cp/pt.c:20531
0x72c6bd tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../source/gcc/cp/pt.c:19873
0x72c6bd tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../source/gcc/cp/pt.c:19873
0x73e1e4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../source/gcc/cp/pt.c:19266
0x73e1e4 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../source/gcc/cp/pt.c:18879
0x72f59b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../source/gcc/cp/pt.c:17933
0x72f59b tsubst(tree_node*, tree_node*, int, tree_node*)
../../source/gcc/cp/pt.c:15349
0x72f1e3 tsubst(tree_node*, tree_node*, int, tree_node*)
../../source/gcc/cp/pt.c:15792
0x742ec2 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
../../source/gcc/cp/pt.c:13215
0x72c209 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../source/gcc/cp/pt.c:19333
0x73e1e4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../source/gcc/cp/pt.c:19266
0x73e1e4 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../source/gcc/cp/pt.c:18879
0x647cf7 tsubst_constraint(tree_node*, tree_node*, int, tree_node*)
../../source/gcc/cp/constraint.cc:2402
0x647cf7 type_deducible_p
../../source/gcc/cp/constraint.cc:1932
0x64c23a tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
../../source/gcc/cp/constraint.cc:2013
0x72c55e tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../source/gcc/cp/pt.c:20566
0x73e1e4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../source/gcc/cp/pt.c:19266
0x73e1e4 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../source/gcc/cp/pt.c:18879
0x64ba61 satisfy_constraint_r
../../source/gcc/cp/constraint.cc:2610
0x64bee8 satisfy_constraint
../../source/gcc/cp/constraint.cc:2692
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.
### EXPECTED OUTPUT:
(clean compile)
### COMPILER VERSION INFO (g++ -v):
Using built-in specs.
COLLECT_GCC=/opt/wandbox/gcc-head/bin/g++
COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../source/configure --prefix=/opt/wandbox/gcc-head
--enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl
--enable-checking=release --disable-nls --enable-lto
LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-head/lib,-rpath,/opt/wandbox/gcc-head/lib64,-rpath,/opt/wandbox/gcc-head/lib32
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200906 (experimental) (GCC)