https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127426
Bug ID: 127426
Summary: [C++23] ICE in dependent_type_p with concept lambda
and std::generator
Product: gcc
Version: 15.3.1
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: zhenyefan at 163 dot com
CC: zhenyefan at 163 dot com
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build: x86_64-pc-linux-gnu
Created attachment 65606
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65606&action=edit
Minimal reduced C++23 testcase triggering the ICE. Preprocessed source
generated by GCC -freport-bug for the reduced testcase.
The following reduced C++23 testcase causes an internal compiler error in GCC
15.3.1:
#include <generator>
template <typename T>
concept C = []<typename U>(U) {
return true;
}(T{});
template <typename R>
std::generator<int> f(R&& range) {
if constexpr (C<int>) {
co_yield 0;
}
}
Command:
g++ -std=c++23 -fsyntax-only issue2_min6.cpp
Result:
issue2_min6.cpp:4:13: internal compiler error: in dependent_type_p, at
cp/pt.cc:28783
The compiler exits with status 1 and prints a full ICE backtrace.
The same ICE occurs with:
g++ -std=c++23 -fsyntax-only -Wall -Wextra issue2_min6.cpp
g++ -std=c++23 -fsyntax-only -fno-strict-aliasing -fwrapv issue2_min6.cpp
Expected behavior:
The valid C++23 source should be accepted, or diagnosed with a normal
language diagnostic, but GCC should not crash.
GCC version:
g++ (GCC) 15.3.1 20260822
Target:
x86_64-pc-linux-gnu
Configured with:
--enable-languages=c,c++ --disable-multilib --disable-bootstrap