https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92211
Bug ID: 92211 Summary: Lamdas in unevaluated context bug Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pilarlatiesa at gmail dot com Target Milestone: --- This code compiles fine (https://godbolt.org/z/JeuX4m): template<int dim, int rank> struct Tensor {}; template<int dim, int rank> double mag(Tensor<dim, rank> const &) { return 0.0; } template<int dim, int rank> using TMag = decltype([](Tensor<dim, rank> const &x) { return mag(x); }); template<typename TOp> class UnaryExpr { TOp const Op = {}; }; UnaryExpr<TMag<0, 666>> fn() { return {}; } This one does not (https://godbolt.org/z/rD3v8E): template<int dim, int rank> struct Tensor {}; template<int dim, int rank> double mag(Tensor<dim, rank> const &) { return 0.0; } template<int dim, int rank> using TMag = decltype([](Tensor<dim, rank> const &x) { return mag(x); }); template<typename TOp> class UnaryExpr { TOp const Op = {}; }; template<int dim, int rank> UnaryExpr<TMag<dim, rank>> fn() { return {}; } This one causes GGC to segfault (https://godbolt.org/z/8GsGYe) template<int dim, int rank> struct Tensor {}; template<int dim, int rank> double mag(Tensor<dim, rank> const &) { return 0.0; } template<int dim, int rank> using TMag = decltype([](Tensor<dim, rank> const &x) { return mag(x); }); template<typename TOp> class UnaryExpr { TOp const Op = {}; }; template<int dim, int rank, typename T = TMag<dim, rank>> UnaryExpr<T> fn() { return {}; }