From: Daniel Arndt Date: Thu, 28 Jun 2018 14:08:03 +0000 (+0200) Subject: Make IdentityMatrix constrcutor explicit X-Git-Tag: v9.1.0-rc1~971^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09328f5fe2ab5282e4d453831387d023b68791e0;p=dealii.git Make IdentityMatrix constrcutor explicit --- diff --git a/include/deal.II/lac/identity_matrix.h b/include/deal.II/lac/identity_matrix.h index 0c1bdb85e6..e418b61d7a 100644 --- a/include/deal.II/lac/identity_matrix.h +++ b/include/deal.II/lac/identity_matrix.h @@ -85,7 +85,7 @@ public: /** * Constructor. Creates a identity matrix of size #n. */ - IdentityMatrix(const size_type n); + explicit IdentityMatrix(const size_type n); /** * Resize the matrix to be of size #n by #n. diff --git a/tests/lac/identity_matrix_07.cc b/tests/lac/identity_matrix_07.cc new file mode 100644 index 0000000000..d4336f84db --- /dev/null +++ b/tests/lac/identity_matrix_07.cc @@ -0,0 +1,35 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2018 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + +// Check that clearing a FullMatrix using a number type convertible to +// Number is not ambiguous. + +#include +#include +#include + +#include "../tests.h" + +int +main() +{ + initlog(); + FullMatrix> matrix1; + matrix = 0.; + + deallog << "OK" << std::endl; + return 0; +} diff --git a/tests/lac/identity_matrix_07.output b/tests/lac/identity_matrix_07.output new file mode 100644 index 0000000000..29bcfce3a3 --- /dev/null +++ b/tests/lac/identity_matrix_07.output @@ -0,0 +1,9 @@ + +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4.