This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34338] New: error: no matching function for call to 'C::count()'
- From: "gray_song at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Dec 2007 20:59:03 -0000
- Subject: [Bug c++/34338] New: error: no matching function for call to 'C::count()'
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Following code does not compile, and got error messages:
g++ hello.cpp
hello.cpp: In member function 'long long int C::count(int)':
hello.cpp:10: error: no matching function for call to 'C::count()'
hello.cpp:9: note: candidates are: long long int C::count(int)
hello.cpp: In function 'int main(char**)':
hello.cpp:31: error: no matching function for call to 'D::count(int)'
hello.cpp:21: note: candidates are: virtual long long int D::count()
#include <stdio.h>
class A {
public:
virtual long long count() = 0;
};
class C : public A{
public:
long long count(int l) {
return count();
}
long long another() {
return dtrs();
}
long long dtrs(){
return 0;
}
};
class D : public C {
public:
long long count() {
return 5;
}
};
int main(char* argv[])
{
printf("hello world, hello\n");
D d;
//C c;
printf("d.count():%d\n", d.count(02734));
}
--
Summary: error: no matching function for call to 'C::count()'
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gray_song at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34338