public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6508: compilation error when using "min< double >" as function parameter
@ 2002-06-05  9:01 lerdsuwa
  0 siblings, 0 replies; 3+ messages in thread
From: lerdsuwa @ 2002-06-05  9:01 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, yap_noel

Synopsis: compilation error when using "min< double >" as function parameter

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Wed Jun  5 09:01:29 2002
State-Changed-Why:
    Not a bug.  There are 2 overloading functions
      template <class T> const T& min(const T&, const T&);
    and
      template <class T, class Comp> const T& min(const T&, const T&,
    				Comp);
    that match the argument of test.  The actual function call
    inside test is not part of the deduction process.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6508


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/6508: compilation error when using "min< double >" as function parameter
@ 2002-05-07 15:46 Reichelt
  0 siblings, 0 replies; 3+ messages in thread
From: Reichelt @ 2002-05-07 15:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/6508; it has been noted by GNATS.

From: Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, yap_noel@olf.com, gcc-bugs@gcc.gnu.org,
        nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/6508: compilation error when using "min< double >" as function parameter
Date: Wed, 8 May 2002 01:11:03 +0200

 Hi,
 
 the bug can be reproduced with the following code snippet:
 
 --------------------------snip here---------------------
 template<typename T> void foo(T) { }
 void foo() { }
 
 template < typename Fn >
 void bar(Fn f)
 {
     f();
 }
 
 void quux()
 {
     bar(foo);
 }
 --------------------------snip here---------------------
 
 The bug is still present in gcc 3.1 20020506 (prerelease).
 
 Greetings,
 Volker Reichelt
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6508
 
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* c++/6508: compilation error when using "min< double >" as function parameter
@ 2002-04-29 11:06 yap_noel
  0 siblings, 0 replies; 3+ messages in thread
From: yap_noel @ 2002-04-29 11:06 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-06-05 16:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-05  9:01 c++/6508: compilation error when using "min< double >" as function parameter lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2002-05-07 15:46 Reichelt
2002-04-29 11:06 yap_noel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).