Boost logo

Ublas :

From: Paul C. Leopardi (leopardi_at_[hidden])
Date: 2005-09-07 19:13:17

Hi Michael,
Have you tried with the latest snapshot of gcc 4.1 ?

Try testing with pre-4.0.1 snapshots 4.0-20050507 versus 4.0-20050514 to see
if the following changes by Nathan Sidwell affect this bug:

2005-05-10 Nathan Sidwell <nathan_at_[hidden]>

        PR c++/20723
        * pt.c (more_specialized_fn): Member functions are unordered wrt
        non-members. Conversion operators are unordered wrt other

        PR c++/19203, implement DR 214
        * call.c (joust): Use more_specialized_fn.
        * cp-tree.h (DEDUCE_ORDER): Remove.
        (more_specialized): Replace with ...
        (more_specialized_fn): ... this.
        * pt.c (maybe_adjust_types_for_deduction): Remove DEDUCE_ORDER
        (type_unification_real): Remove DEDUCE_ORDER case.
        (more_specialized): Replace with ...
        (more_specialized_fn): ... this. Implement DR 214.
        (most_specialized_instantiation): Use get_bindings_real directly.

PR 23513 may also be related. See

The change we are seeing may be related to C++ Standard Core Language Issue
402. See and

402. More on partial ordering of function templates
Section: temp.func.order
Status: open
Submitter: Nathan Sidwell
Date: 7 Apr 2003

I've tried with a few different versions and snapshots, with results:

With gcc version 3.3.5 20050117 (prerelease) (SUSE Linux)
your simple case compiles OK.

Each of
gcc version 4.0.1
gcc version 4.0.2 20050825 (prerelease)
gcc version 4.1.0 20050813 (experimental)
gives an error message about an ambiguity:

simple.cpp: In function ‘int main()’:
simple.cpp:17: error: call of overloaded ‘prod(main()::mat&,
boost::numeric::ublas::matrix_range<main()::mat>&)‘ is ambiguous
../boost/numeric/ublas/matrix_expression.hpp:4636: note: candidates are:
typename boost::numeric::ublas::matrix_matrix_binary_traits<typename
E1::value_type, E1, typename E2::value_type, E2>::result_type
boost::numeric::ublas::matrix_expression<E>&, const
boost::numeric::ublas::matrix_expression<E2>&) [with E1 = main()::mat, E2 =
../boost/numeric/ublas/matrix_expression.hpp:4695: note: M
boost::numeric::ublas::matrix_expression<E2>&, const
boost::numeric::ublas::matrix_expression<E2>&) [with M = main()::mat, E1 =
boost::numeric::ublas::basic_row_major<size_t, ptrdiff_t>,
boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >, E2
= boost::numeric::ublas::matrix_range<main()::mat>]

Best regards, Paul Leopardi

PS, the following, slightly simpler code fails on the line containing "mat Q".

#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
using namespace boost::numeric::ublas;
int main()
 typedef matrix<double> mat;
 mat K;
 matrix_range<mat> H_ (K, range(0,0), range(0,0));
 mat P = prod(K,H_);
 mat Q = prod<mat>(K,H_);

On Thu, 8 Sep 2005 05:15, Michael Stevens wrote:
> I remember this report. I thought it had Joergs name on it as reporter. I
> spent a while searching GCC bugzilla and I can't find it. If you still have
> a reference it would be very useful.
> I compiled up the offical GCC 4.0.1 release. I can confirm that 4.0.1 finds
> the prod versions ambigous. GCC 4.0.0 and anything prior does not.
> > Interessting enough: nobody was sure to interpret the standard correctly
> >
> > :).
> I've been trying to find a standard Defect Report related to this but with
> no luck.
> For comparision Intel 8.1 (EDG base) accepts the code. VC-7.1 rejects as
> ambigous.
> 4.0.1 make a couple of changes to related issues. The following look
> relavant
> "[3.4/4.0 Regression] [DR 214] Partial ordering failure between function
> reference and generic const reference"
> "[4.0 only] [DR 214] Template parameter deduction fails for overloaded
> template functions."
> Sadly neither explictly changes the simple case we are looking at.
> Michael