Constrained member functions and explicit template instantiation
问题 G++ and Clang++ agree that the following snippet is not valid C++: template<int dim, int rank> struct Tensor {}; template<int dim> double InnerProduct(Tensor<dim, 1> const &, Tensor<dim, 1> const &) { return 0.0; } template<int dim> double DoubleInnerProduct(Tensor<dim, 2> const &, Tensor<dim, 2> const &) { return 0.0; } template<int dim, int rank> class Field { private: static double Dot(Tensor<dim, rank> const &u, Tensor<dim, rank> const &v) requires (rank == 1) { return InnerProduct(u, v);