public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28330]  New: finds wrong template overload; peculiar diagnostic
@ 2006-07-10 20:11 igodard at pacbell dot net
  2006-07-10 20:11 ` [Bug c++/28330] " igodard at pacbell dot net
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: igodard at pacbell dot net @ 2006-07-10 20:11 UTC (permalink / raw)
  To: gcc-bugs

The error is an invocation of operator<<(ring<cacheRequest>&, loadRequest*).
ring<cacheRequest> defines operator<<(ring<cacheRequest>&, cacheRequest*), and 
cacheRequest is a public base of the actual loadRequest argument. If the right 
argument is explicitly cast to cacheRequest* (as shown in the line immediately 
before the reported error) the correct operator<< is found and invoked.

However, when the argument is the derived class the compiler finds and invokes 
an irrelevant definition of operator<< and then blows up inside it. The 
definition it finds is declared by template wideUint<size_t> and in particular 
by wideUint<1>: operator<<(wideUint<1>, const uint32_t&). Somehow it seems to 
decide that it can turn a ring<cacheRequest>& into a wideUint<1>, and then 
complains that it can't turn a cacheRequest* into a uint32_t (which is a
typedef 
for unsigned int).

It seems to me that the compiler should be able to match the intended operator 
by converting to the base class. However, even if it cannot then shouldn't it 
just say "no match found for ..." rather than accepting the bogus match and
then 
complaining about the conversion to uint32_t?


-- 
           Summary: finds wrong template overload; peculiar diagnostic
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net


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


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

end of thread, other threads:[~2009-12-08 21:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-10 20:11 [Bug c++/28330] New: finds wrong template overload; peculiar diagnostic igodard at pacbell dot net
2006-07-10 20:11 ` [Bug c++/28330] " igodard at pacbell dot net
2006-07-10 20:12 ` igodard at pacbell dot net
2006-07-11  8:29 ` bangerth at dealii dot org
2008-03-02 10:57 ` truedfx at gentoo dot org
2009-12-08 21:07 ` redi at gcc dot gnu dot org

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