On Fri, Nov 18, 2022 at 10:03:18AM -0500, Marek Polacek wrote: > > the lambda operator() when still a template as constexpr and then > > cp_finish_decl -> diagnose_static_in_constexpr pedwarns on it. > > For the above perhaps we could figure out there is a static int k; in the > > operator() and don't turn it into constexpr, but what if there is > > something that would e.g. satisfy decl_maybe_constant_var_p but not > > decl_constant_var_p when actually instantiated? > > Without my patch, the diagnostics is in start_decl which isn't called again > > during instantiation, so I presume we mark it as constexpr and then we'd > > diagnose it during constant evaluation. > > Um, can we give up on trying to handle C++17/C++20 then?
That was why I've posted the other two variant patches (with the 3rd one being a strict C++23 only change). Even if it is just a temporary state, make C++23 work first and then iterate if it is possible to make C++17/20 working with the pedwarns right. Jakub