public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11752] New: partial ordering overloaded function templates
@ 2003-07-31 18:48 nbecker at fred dot net
  2003-07-31 19:08 ` [Bug c++/11752] " pinskia at physics dot uc dot edu
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: nbecker at fred dot net @ 2003-07-31 18:48 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11752

           Summary: partial ordering overloaded function templates
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nbecker at fred dot net
                CC: gcc-bugs at gcc dot gnu dot org

In the following example, I believe the call should not be ambiguous, because 
the second overloaded Rnd function is more specialized, and partial ordering 
should apply: 
 
template<int shift, int size, typename T> 
inline T Rnd (T x) { 
  T y = x >> (shift - 1); 
  if (y == Sint<size+1>::max) 
    return y >> 1; 
  else 
    return (y + 1) >> 1; 
} 
 
template<int shift, int size, typename FLT> 
inline std::complex<FLT> Rnd (std::complex<FLT> x) { 
  return std::complex<FLT> (Rnd<size, shift, FLT> (real (x)), Rnd<size, shift, 
FLT> (imag (x))); 
} 
 
../Test/Test6.cc:224: call of overloaded `Rnd(std::complex<int>)' is ambiguous 
../src/fixed/FixedUtil.H:18: candidates are: T Rnd(T) [with int shift = 6, int  
   size = 8, T = std::complex<int>] 
../src/fixed/FixedUtil.H:27:                 std::complex<FLT>  
   Rnd(std::complex<FLT>) [with int shift = 6, int size = 8, FLT = int] 
gcc -v 
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs 
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man 
--infodir=/usr/share/info --enable-shared --enable-threads=posix 
--disable-checking --with-system-zlib --enable-__cxa_atexit 
--host=i386-redhat-linux 
Thread model: posix 
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)


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

end of thread, other threads:[~2003-08-05 16:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-31 18:48 [Bug c++/11752] New: partial ordering overloaded function templates nbecker at fred dot net
2003-07-31 19:08 ` [Bug c++/11752] " pinskia at physics dot uc dot edu
2003-07-31 19:16 ` nbecker at hns dot com
2003-08-04 14:54 ` nbecker at fred dot net
2003-08-04 14:58 ` pinskia at physics dot uc dot edu
2003-08-04 14:58 ` pinskia at physics dot uc dot edu
2003-08-04 19:44 ` pinskia at physics dot uc dot edu
2003-08-05 16:29 ` lerdsuwa at gcc dot gnu dot org
2003-08-05 16:33 ` bangerth at dealii dot org
2003-08-05 16:50 ` nbecker at hns dot com

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).