https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127573
Bug ID: 127573
Summary: [c++23] ICE: unexpected expression of kind
implicit_conv_expr with constexpr std::array of
std::string_view in lambda inside a template
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: s103360021 at gmail dot com
Target Milestone: ---
Created attachment 65669
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65669&action=edit
Preprocessed source from -freport-bug
When initializing a constexpr `std::array<std::string_view, N>` with string
literals inside a lambda, which is itself inside a template function, GCC trunk
(17.0.0) crashes with an internal compiler error related to implicit_conv_expr.
The ICE does not occur if the lambda is in a non-template function.
Godbolt link: https://godbolt.org/z/48of4drc9
Minimal Reproducible Example
```C++
#include <array>
#include <cstdlib>
#include <string_view>
template <typename T>
void trigger_bug()
{
auto test_lambda = [&]()
{
constexpr std::array<std::string_view, 4> policies = {"seq", "par",
"par_unseq", "unseq"};
};
}
int main()
{
trigger_bug<int>();
return EXIT_SUCCESS;
}
```