[Dune] [#1024] Constructor call DiagonalMatrix<K, n>::DiagonalMatrix(FieldVector<K, 1>) ambiguous for n>2

Dune flyspray at dune-project.org
Thu Jan 19 14:51:50 CET 2012


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

A new Flyspray task has been opened.  Details are below. 

User who did this - Uli Sack (usack) 

Attached to Project - Dune
Summary - Constructor call DiagonalMatrix<K,n>::DiagonalMatrix(FieldVector<K,1>) ambiguous for n>2
Task Type - Bug Report
Category - Dune Core Modules
Status - Unconfirmed
Assigned To - 
Operating System - Unspecified / All
Severity - Low
Priority - Normal
Reported Version - SVN (pre2.2)
Due in Version - Undecided
Due Date - Undecided
Details - DiagonalMatrix has two relevant Constructors here:
    //! Constructor initializing the whole matrix with a scalar
    DiagonalMatrix (const K& k)
        : diag_(k)
    {}

    //! Constructor initializing the diagonal with a vector
    DiagonalMatrix (const FieldVector<K,n>& diag)
        : diag_(diag)
    {}

I would expect due to the conversion FieldVector<K,1>::operator K() that the first constructor would be called, since FieldVector<K,1> on first sight doesn't match the signature of the second. But owing to implicit type conversion and the constructor
    FieldVector<K,n>::template<class C> FieldVector (const DenseVector<C> & x)
it actually does. The compiler doesn't care that the static_assertion will fail anyway.

A possible way to fix this behavior would be to make the named Constructor in FieldVector explicit just as its close relative is:
        template<class K1, int SIZE1>
	explicit FieldVector (const FieldVector<K1,SIZE1> & x)

So my question is, if there is a necessity for the first mentioned FieldVector-constructor to not be explicit. If the answer is no I request it to be made explicit.



More information can be found at the following URL:
http://www.dune-project.org/flyspray/index.php?do=details&task_id=1024

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.




More information about the Dune mailing list