public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24658]  New: overloaded function lookup in base class fails
@ 2005-11-03 15:59 thorsten dot gecks at uni-bayreuth dot de
  2005-11-03 16:03 ` [Bug c++/24658] " pinskia at gcc dot gnu dot org
  2005-11-03 16:49 ` thorsten dot gecks at uni-bayreuth dot de
  0 siblings, 2 replies; 3+ messages in thread
From: thorsten dot gecks at uni-bayreuth dot de @ 2005-11-03 15:59 UTC (permalink / raw)
  To: gcc-bugs

Compiler version details:
*************************

gcc -v

Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.4/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada
--disable-checking --libdir=/usr/lib --enable-libgcj
--with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib
--enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.4 (pre 3.3.5 20040809)



Sample code producing the error:
********************************

class A{};
class B{};

class C
{
public:
  int f(A){return 4;}

};

class D : public C
{
public:
  int f(B){return 4;}
};

int main(int, char **)
{
  D d;
  A a;
  int res = d.f(a);
  return res;
}


Compiler error message:
***********************

test.cpp: In function `int main(int, char**)':
test.cpp:26: error: no matching function for call to `D::f(A&)'
test.cpp:16: error: candidates are: int D::f(B)


-- 
           Summary: overloaded function lookup in base class fails
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: thorsten dot gecks at uni-bayreuth dot de


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


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

* [Bug c++/24658] overloaded function lookup in base class fails
  2005-11-03 15:59 [Bug c++/24658] New: overloaded function lookup in base class fails thorsten dot gecks at uni-bayreuth dot de
@ 2005-11-03 16:03 ` pinskia at gcc dot gnu dot org
  2005-11-03 16:49 ` thorsten dot gecks at uni-bayreuth dot de
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-03 16:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-11-03 16:03 -------
This is not a bug, this is how C++ works.  The f in D hides the one in C unless
you add "using C::f;".


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/24658] overloaded function lookup in base class fails
  2005-11-03 15:59 [Bug c++/24658] New: overloaded function lookup in base class fails thorsten dot gecks at uni-bayreuth dot de
  2005-11-03 16:03 ` [Bug c++/24658] " pinskia at gcc dot gnu dot org
@ 2005-11-03 16:49 ` thorsten dot gecks at uni-bayreuth dot de
  1 sibling, 0 replies; 3+ messages in thread
From: thorsten dot gecks at uni-bayreuth dot de @ 2005-11-03 16:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from thorsten dot gecks at uni-bayreuth dot de  2005-11-03 16:49 -------
Subject: Re:  overloaded function lookup in base class fails

pinskia at gcc dot gnu dot org schrieb:
> ------- Comment #1 from pinskia at gcc dot gnu dot org  2005-11-03 16:03 -------
> This is not a bug, this is how C++ works.  The f in D hides the one in C unless
> you add "using C::f;".
> 
> 

Thank you for the fast reply, but shouldn't the compiler distinguish the 
two functions by argument?

Best regards,

TG


-- 


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


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

end of thread, other threads:[~2005-11-03 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-03 15:59 [Bug c++/24658] New: overloaded function lookup in base class fails thorsten dot gecks at uni-bayreuth dot de
2005-11-03 16:03 ` [Bug c++/24658] " pinskia at gcc dot gnu dot org
2005-11-03 16:49 ` thorsten dot gecks at uni-bayreuth dot de

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