From: Matthias Maier Date: Tue, 8 Sep 2015 16:04:55 +0000 (-0500) Subject: Bugfix: Disallow templated constructor/copy assignment for derived classes X-Git-Tag: v8.4.0-rc2~458^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fab21900b43414bc6d76cc09d907c58752103c0;p=dealii.git Bugfix: Disallow templated constructor/copy assignment for derived classes --- diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index bc09bbf58d..2b4808d403 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -22,8 +22,9 @@ #ifdef DEAL_II_WITH_CXX11 -#include #include +#include +#include DEAL_II_NAMESPACE_OPEN @@ -169,11 +170,12 @@ public: LinearOperator (const LinearOperator &) = default; /** - * Templated copy constructor that creates a LinearOperator object from an - * object @p op for which the conversion function + * Templated copy constructor that creates a LinearOperator object from + * an object @p op for which the conversion function * linear_operator is defined. */ - template + template, Op>::value>::type> LinearOperator (const Op &op) { *this = linear_operator(op); @@ -189,7 +191,8 @@ public: * Templated copy assignment operator for an object @p op for which the * conversion function linear_operator is defined. */ - template + template , Op>::value>::type> LinearOperator &operator=(const Op &op) { *this = linear_operator(op); diff --git a/tests/lac/block_linear_operator_01.cc b/tests/lac/block_linear_operator_01.cc index 1d4d6149a4..5c4e033f2c 100644 --- a/tests/lac/block_linear_operator_01.cc +++ b/tests/lac/block_linear_operator_01.cc @@ -112,6 +112,13 @@ int main() }; auto op_b = block_operator<2, 2, BlockVector>(temp); + { + // also test copy and reference assignment to a LinearOperator + LinearOperator> &op_x1 = op_b; + LinearOperator> op_x2 = op_b; + LinearOperator> op_x3(op_b); + } + // vmult: BlockVector u;