public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18044] New: method signatures with argument overloading does not work across class boundaries
@ 2004-10-18 10:35 oyvind dot harboe at zylin dot com
  2004-10-18 11:36 ` [Bug c++/18044] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: oyvind dot harboe at zylin dot com @ 2004-10-18 10:35 UTC (permalink / raw)
  To: gcc-bugs

This does not compile:

class Foo
{
public:
  void test(char *x)
  {
  }
};

class Bar : public Foo
{
public:
  void test(double t)
  {
    test("x");
  }
};


$ g++ -c test2.cc
test2.cc: In member function `void Bar::test(double)':
test2.cc:14: error: no matching function for call to `Bar::test(const char[2])'
test2.cc:13: error: candidates are: void Bar::test(double)

To make it compile, change to:

class Foo
{
public:
  void testy(char *x)
  {
  }
};

class Bar : public Foo
{
public:
  void test(double t)
  {
    testy("x");
  }
};

-- 
           Summary: method signatures with argument overloading does not
                    work across class boundaries
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oyvind dot harboe at zylin dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/18044] method signatures with argument overloading does not work across class boundaries
  2004-10-18 10:35 [Bug c++/18044] New: method signatures with argument overloading does not work across class boundaries oyvind dot harboe at zylin dot com
@ 2004-10-18 11:36 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-18 11:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-18 11:36 -------
Invalid, test in Bar hides test in Foo.
Either use:
  using Foo::test;
in front of the declaration of test in Bar.
Or use the full name of test in Foo:
class Foo
{
public:
  void test(char *x)
  {
  }
};

class Bar : public Foo
{
public:
  void test(double t)
  {
    Foo::test("x");
  }
};

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


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


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

end of thread, other threads:[~2004-10-18 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-18 10:35 [Bug c++/18044] New: method signatures with argument overloading does not work across class boundaries oyvind dot harboe at zylin dot com
2004-10-18 11:36 ` [Bug c++/18044] " pinskia 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).