public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18289] New: GCC3.4.2 selects incorrect function overload when an ellipsis overload is available
@ 2004-11-03 20:29 aleethorp at hotmail dot com
  2004-11-03 20:57 ` [Bug c++/18289] " pinskia at gcc dot gnu dot org
  2004-11-03 21:03 ` reichelt at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: aleethorp at hotmail dot com @ 2004-11-03 20:29 UTC (permalink / raw)
  To: gcc-bugs

GCC 3.4.2 selects an overload that requires an inaccessible conversion when an
ellipsis function overload is available

Platform is Cygwin on Windows 2000.

See the example below.

class A {};
class B : public A {};
class C : private A {};

void f(...);
void f(A*);
void error()
{
  f(static_cast<B*>(0));
  f(static_cast<C*>(0)); // <- Line 42
}

Conversion.cc: In function `void error()':
Conversion.cc:42: error: `A' is an inaccessible base of `C'

-- 
           Summary: GCC3.4.2 selects incorrect function overload when an
                    ellipsis overload is available
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aleethorp at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/18289] GCC3.4.2 selects incorrect function overload when an ellipsis overload is available
  2004-11-03 20:29 [Bug c++/18289] New: GCC3.4.2 selects incorrect function overload when an ellipsis overload is available aleethorp at hotmail dot com
@ 2004-11-03 20:57 ` pinskia at gcc dot gnu dot org
  2004-11-03 21:03 ` reichelt at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-03 20:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-03 20:57 -------
Note ICC 8.0 also rejects this.

-- 


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


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

* [Bug c++/18289] GCC3.4.2 selects incorrect function overload when an ellipsis overload is available
  2004-11-03 20:29 [Bug c++/18289] New: GCC3.4.2 selects incorrect function overload when an ellipsis overload is available aleethorp at hotmail dot com
  2004-11-03 20:57 ` [Bug c++/18289] " pinskia at gcc dot gnu dot org
@ 2004-11-03 21:03 ` reichelt at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-03 21:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-11-03 21:03 -------
This is not a bug.

[13.3.3.2]/2 says that a standard conversion sequence is better
than an ellipsis conversion sequence.

The note in [13.3]/1 says:
The function selected by overload resolution is not guaranteed to
be appropriate for the context. Other restrictions, such as the
accessibility of the function, can make its use in the calling
context ill-formed.

Converting a pointer to a pointer of a base class is a standard
conversion. So gcc is right in choosing f(A*) and complaining
about it later.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2004-11-03 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-03 20:29 [Bug c++/18289] New: GCC3.4.2 selects incorrect function overload when an ellipsis overload is available aleethorp at hotmail dot com
2004-11-03 20:57 ` [Bug c++/18289] " pinskia at gcc dot gnu dot org
2004-11-03 21:03 ` reichelt 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).