public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dodji at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/46824] chromium-compile failed because error: no match for ‘operator*’ in
Date: Thu, 10 Mar 2011 21:21:00 -0000	[thread overview]
Message-ID: <bug-46824-4-wKTkV0m3rQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46824-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-03-10 21:20:52 UTC ---
Thank you for reducing this.

Here is what I understand from the reduced test case.

For the expression "*p" the compiler uses overload resolution to
determine which operator "*" to use.  As there is no user provided
operator*() that can take an instance of Ptr in argument, the only
choice left is to consider the built-in operator*() as a viable
candidate for overload resolution.

But then the note in [over.built]/1 says:

    because built-in operators take only operands with non-class type, and
    operator overload resolution occurs only when an operand expression
    originally has class or enumeration type, operator overload resolution
    can resolve to a built-in operator only when an operand has a class type
    that has a user-defined conversion to a non-class type appropriate for
    the operator, or when an operand has an enumeration type that can be
    converted to a type appropriate for the operator.

As there is no user-defined conversion operator that would convert Ptr
into a pointer to native type, the built-in operator*() is not a viable
candidate.

Thus I believe the test case is ill-formed and the user-defined
conversion operator that converts Ptr to Incomplete* seems to be of
little use in this case.

So for the built-in operator to be selected, we'd need e.g, a
user-defined conversion operator Ptr::operator int* ().  Otherwise we'd
need a user-defined operator 'something Ptr::operator*()'.


  parent reply	other threads:[~2011-03-10 21:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06 16:02 [Bug c++/46824] New: " kuh3h3 at gmail dot com
2010-12-06 16:27 ` [Bug c++/46824] " kuh3h3 at gmail dot com
2010-12-06 16:30 ` paolo.carlini at oracle dot com
2010-12-07 11:18 ` rguenth at gcc dot gnu.org
2010-12-07 12:13 ` kuh3h3 at gmail dot com
2011-03-10 17:20 ` jakub at gcc dot gnu.org
2011-03-10 18:04 ` redi at gcc dot gnu.org
2011-03-10 18:09 ` redi at gcc dot gnu.org
2011-03-10 21:21 ` dodji at gcc dot gnu.org [this message]
2011-03-10 21:30 ` jason at gcc dot gnu.org
2011-03-10 22:27 ` redi at gcc dot gnu.org
2011-03-10 22:53 ` dodji at gcc dot gnu.org
2011-03-10 22:57 ` dodji at gcc dot gnu.org
2011-03-11 10:06 ` [Bug c++/46824] [4.6 Regression] " rguenth at gcc dot gnu.org
2011-03-11 11:58 ` redi at gcc dot gnu.org
2011-03-11 14:21 ` rguenth at gcc dot gnu.org
2011-03-12  7:28 ` dodji at gcc dot gnu.org
2011-03-12  7:59 ` jakub at gcc dot gnu.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-46824-4-wKTkV0m3rQ@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).