https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118893
Bug ID: 118893 Summary: ICE (internal compiler error) on building a literal object by using an ill-formed static operator of a lambda (coerce_template_parms) Product: gcc Version: 14.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ing.russomauro at gmail dot com Target Milestone: --- Created attachment 60510 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60510&action=edit Full code containing also the additional problems and the 5 questions. In the following code, you can find how to trigger the ICE. Corresponding code is marked as "MAIN PROBLEM". template<auto> struct requires_constant{}; template<typename> struct C1{ constexpr C1(){} //constexpr C1(C1 const&){}; C1(C1&&){}; }; template<typename T> void f(){ //MAIN PROBLEM) //This code generates the following ICE: //"internal compiler error: in coerce_template_parms, at cp/pt.cc:9398" //It only happens if 'static' is applied. auto g1 = []() static constexpr{C1<T> a{}; return a;}; requires_constant<g1()> y; } int main(){ f<int>(); return 0; } Seems (not deeply checked) not related to any open problem that refers coerce_template_parms. Additionally, I report other problems [1), 2), 3)] around my testing on constexpr, please check them. If you believe I should open separated bugs for them (provided that they are), please, let me know. Finally, I am not sure if I can bore you with 5 further questions. You may find in the full code ["QUESTION 1" ... "QUESTION 5"]. Please ignore (but notify me) in case you prefer not to take care about them. The full code with also the additional problems and the five questions is in attachment, as well as on https://godbolt.org/z/Mche4xvdc .