https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108975
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> --- A slightly more reduced: int h(int); template <int dim> auto hh() { return 0; } template<int a> void mm() { const unsigned num_elements = 1; constexpr int dim = 1; [&]() { typedef decltype(hh<dim>()) derivative_type; h(num_elements * 1); }; } void u() { mm<1>(); }