public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "igodard at pacbell dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/28330]  New: finds wrong template overload; peculiar diagnostic
Date: Mon, 10 Jul 2006 20:11:00 -0000	[thread overview]
Message-ID: <bug-28330-6594@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2006-07-10 20:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-10 20:11 igodard at pacbell dot net [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28330-6594@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).