From: Matthias Maier Date: Sat, 12 Sep 2015 23:47:11 +0000 (-0500) Subject: Bugfix: Allow compilation in C++98 mode X-Git-Tag: v8.4.0-rc2~433^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f61b1485f9d54066349239c83361db231f13c42e;p=dealii.git Bugfix: Allow compilation in C++98 mode The boost variant boost::enable_if_c cannot be used to prevent the compiler from trying to form Tensor objects with negative rank - this results in an infinite template substitution and subsequent failure. But we can use the tensor class itself as cheap "enable_if" mechanism - just specialize Tensor<-1, dim> and Tensor<-2, dim> such that they do not contain the necessary overloads. --- diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 706effbefc..15d2754898 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -34,6 +34,19 @@ DEAL_II_NAMESPACE_OPEN template class Point; template class Tensor; +#ifndef DOXYGEN +// Overload invalid tensor types of negative rank that come up during +// overload resolution of operator* and related contraction variants. +template +class Tensor<-2, dim, Number> +{ +}; + +template +class Tensor<-1, dim, Number> +{ +}; +#endif /* DOXYGEN */ /** @@ -1502,10 +1515,7 @@ operator- (const Tensor &p, const Tensor * @relates ProductType */ template ::type, - typename = typename std::enable_if::type> - + typename Number, typename OtherNumber> inline typename Tensor::type>::tensor_type operator * (const Tensor &src1,