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

Reply via email to