This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/6508: compilation error when using "min< double >" as function parameter
- From: yap_noel at olf dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 29 Apr 2002 17:57:14 -0000
- Subject: c++/6508: compilation error when using "min< double >" as function parameter
- Reply-to: yap_noel at olf dot com
>Number: 6508
>Category: c++
>Synopsis: compilation error when using "min< double >" as function parameter
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon Apr 29 11:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Noel Yap
>Release: gcc 2.95 and 3.0.3
>Organization:
>Environment:
CYGWIN_NT-5.0 OLFDEV1 1.3.10(0.51/3/2) 2002-02-25 11:14 i686 unknown
>Description:
When I try to call a function with a parameter of "min< double >", it
complains with the error:
no matching function for call to `matrix_min_path (Matrix<double> &, plus<double>, {unknown type})'
>How-To-Repeat:
g++ -g -I /home/nyap/opt/mtl-2.1.2.20/include -Wall asdf.cc -o asdf
where asdf.cc contains:
#include <algorithm>
template < typename BinaryFn >
void test(BinaryFn fn)
{
fn(0, 1);
}
int
main(int argc, char *argv[])
{
test(min< double >);
}
>Fix:
The following is a workaround:
#include <algorithm>
template < typename BinaryFn >
void test(BinaryFn fn)
{
fn(0, 1);
}
int
main(int argc, char *argv[])
{
const double &(*minFn)(const double &, const double &) = min< double >;
test(minFn);
}
>Release-Note:
>Audit-Trail:
>Unformatted: